yoctore/yocto-express

View on GitHub

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');
Severity: Major
Found in src/index.js - About 1 day to fix

    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
    Severity: Major
    Found in src/index.js - About 5 hrs to fix

      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 ] -',
      Severity: Minor
      Found in src/index.js - About 2 hrs to fix

      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 ] -',
      Severity: Major
      Found in src/index.js - About 2 hrs to fix

        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 ] -',
        Severity: Major
        Found in src/index.js - About 2 hrs to fix

          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 ] -',
          Severity: Major
          Found in src/index.js - About 2 hrs to fix

            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'),
            Severity: Major
            Found in Gruntfile.js - About 2 hrs to fix

              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.');
              Severity: Minor
              Found in src/index.js - About 2 hrs to fix

                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 ] -',
                Severity: Minor
                Found in src/index.js - About 1 hr to fix

                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 ?
                Severity: Minor
                Found in src/index.js - About 1 hr to fix

                  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) &&
                  Severity: Minor
                  Found in src/index.js - About 1 hr to fix

                  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.');
                  Severity: Minor
                  Found in src/index.js - About 1 hr to fix

                  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');
                  
                  
                  Severity: Critical
                  Found in src/index.js - About 1 hr to fix

                    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 ] -',
                    Severity: Minor
                    Found in src/index.js - About 1 hr to fix

                      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 ] -',
                      Severity: Minor
                      Found in src/index.js - About 55 mins to fix

                      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 ?
                      Severity: Major
                      Found in src/index.js - About 45 mins to fix

                        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;
                                    }
                        Severity: Major
                        Found in src/index.js - About 45 mins to fix

                          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
                          Severity: Major
                          Found in src/index.js - About 40 mins to fix

                            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 ] -',
                            Severity: Minor
                            Found in src/index.js - About 35 mins to fix

                            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 ] -',
                            Severity: Minor
                            Found in src/index.js - About 25 mins to fix

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language