modules/cms/server/controllers/page.js
Function exports
has 363 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
.then((ContentModel, Taxonomy, TaxonomyType, Template, User, Preview) => {
class PageController {
static preview(req, res, next) {
File page.js
has 378 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* jslint esnext:true, node:true */
/* globals LACKEY_PATH */
'use strict';
/*
Copyright 2016 Enigma Marketing Services Limited
Function print
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static print(page, fullPath, res, req, preview) {
let
path,
user = req.user,
Function exports
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
.then((ContentModel, Taxonomy, TaxonomyType, Template, User, Preview) => {
class PageController {
static preview(req, res, next) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function populateContent
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static populateContent(target, item, req, page) {
let includeTaxonomies,
excludeTaxonomies;
return PageController
Function _mapTaxonomyList
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static _mapTaxonomyList(list, req, page) {
return Promise.all(list.map(taxonomy => {
if (taxonomy.ifNot) {
if (PageController.parse(taxonomy.ifNot, req, page)) {
return null;
Function capture
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static capture(req, res, next) {
let route = req.route.toString().replace(/\..*$/, ''),
fullPath = req.protocol + '://' + req.get('host') + route;