Showing 20 of 56 total issues
File index.js
has 748 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
var df = require('dateformat');
var uuid = require('uuid');
var _ = require('lodash');
Function configureWithoutLoad
has 138 lines of code (exceeds 25 allowed). Consider refactoring. Open
Express.prototype.configureWithoutLoad = function (data, isConfigInstance) {
// Create async process
var deferred = Q.defer();
// Normalize a config instance
Function processSession
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
Express.prototype.processSession = function () {
// Config is ready ?
if (!this.isReady()) {
// Error message
this.logger.error([ '[ Express.processSession ] -',
- 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 processSession
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Express.prototype.processSession = function () {
// Config is ready ?
if (!this.isReady()) {
// Error message
this.logger.error([ '[ Express.processSession ] -',
Function processRedirect
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Express.prototype.processRedirect = function () {
// Config is ready ?
if (!this.isReady()) {
// Error message
this.logger.error([ '[ Express.processRedirect ] -',
Function processPrerender
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Express.prototype.processPrerender = function () {
// Config is ready ?
if (!this.isReady()) {
// Error message
this.logger.error([ '[ Express.processPrerender ] -',
Function exports
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (grunt) {
// Init config
grunt.initConfig({
// Default package
pkg : grunt.file.readJSON('package.json'),
Function processBase
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Express.prototype.processBase = function () {
// Config is ready ?
if (!this.isReady()) {
// Error message
this.logger.error('[ Express.processBase ] - Cannot process config. App is not ready.');
Function processPrerender
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Express.prototype.processPrerender = function () {
// Config is ready ?
if (!this.isReady()) {
// Error message
this.logger.error([ '[ Express.processPrerender ] -',
- 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 processJwt
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Express.prototype.processJwt = function () {
// Create async process
var deferred = Q.defer();
// Config is ready ?
Function useDirectory
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Express.prototype.useDirectory = function (name, p) {
// Checking name
if (_.isString(name) && !_.isEmpty(name)) {
// Default path
p = _.isString(p) &&
- 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 processBase
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Express.prototype.processBase = function () {
// Config is ready ?
if (!this.isReady()) {
// Error message
this.logger.error('[ Express.processBase ] - Cannot process config. App is not ready.');
- 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
Consider simplifying this complex logical expression. Open
if (_.isBoolean(jwtoken.enable) && jwtoken.enable &&
_.isString(jwtoken.key) && !_.isEmpty(jwtoken.key)) {
// Debug message
this.logger.debug('[ Express.processJwt ] - Try to process jwt key');
Function processCompression
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Express.prototype.processCompression = function () {
// Config is ready ?
if (!this.isReady()) {
// Error message
this.logger.error([ '[ Express.processCompression ] -',
Function processCompression
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Express.prototype.processCompression = function () {
// Config is ready ?
if (!this.isReady()) {
// Error message
this.logger.error([ '[ Express.processCompression ] -',
- 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
Avoid deeply nested control flow statements. Open
if (validate.value.queryString && !_.isNull(qse.query)) {
// Destination url as sub routes ?
var qsee = url.parse(endUrl);
// Path is already defined and href url not ending by a slash ?
Avoid deeply nested control flow statements. Open
if (_.startsWith(validate.value.toUrl, 'http') ||
_.startsWith(validate.value.toUrl, 'https')) {
// Change endUrl to use full defined url
endUrl = validate.value.toUrl;
}
Consider simplifying this complex logical expression. Open
if (_.has(this.config.get('config'), 'app') &&
_.has(this.config.get('config'), 'env') &&
_.has(this.config.get('config'), 'host') &&
_.has(this.config.get('config'), 'protocol')) {
// Set the default name
Function processCors
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Express.prototype.processCors = function () {
// Config is ready ?
if (!this.isReady()) {
// Error message
this.logger.error([ '[ Express.processCors ] -',
- 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 processRedirect
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Express.prototype.processRedirect = function () {
// Config is ready ?
if (!this.isReady()) {
// Error message
this.logger.error([ '[ Express.processRedirect ] -',
- 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"