yoctore/yocto-config

View on GitHub

Showing 10 of 35 total issues

Function getExpress has 367 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Schema.prototype.getExpress = function () {
  // Default schema
  var schema = {
    // Default app rules
    app : joi.object().required().keys({
Severity: Major
Found in src/schema.js - About 1 day to fix

    File schema.js has 560 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    var joi   = require('joi');
    var _     = require('lodash');
    var utils = require('yocto-utils');
    Severity: Major
    Found in src/schema.js - About 1 day to fix

      Function getRender has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Schema.prototype.getRender = function () {
        // Define meta rules
        var metaHttpEquivRules = joi.object().keys({
          name  : joi.string().required().not(null),
          value : joi.string().required().not(null)
      Severity: Major
      Found in src/schema.js - About 3 hrs to fix

        Function load has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Config.prototype.load = function () {
          // Create async process here
          var deferred = Q.defer();
        
          // Any errors ?? try/catch it
        Severity: Major
        Found in src/index.js - About 2 hrs to fix

          Function exports has 50 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: Minor
          Found in Gruntfile.js - About 2 hrs to fix

            Function getMongoose has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Schema.prototype.getMongoose = function () {
              // Native parser. Exclude it because underscore keys is not a good practicies and hint failed
              // transformation will process at the end
              var nParser = {
                nativeParser : joi.boolean().default(false)
            Severity: Minor
            Found in src/schema.js - About 1 hr to fix

              Function getPassportJs has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              Schema.prototype.getPassportJs = function () {
                // Default validation schema
                var baseSchema = {
                  identifier : joi.string().required().empty().default(null),
                  secret     : joi.string().required().empty(),
              Severity: Minor
              Found in src/schema.js - About 1 hr to fix

                Function find has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                Config.prototype.find = function (name, complete) {
                  // Message
                  this.logger.debug([ '[ Config.find ] - Try to enable config for', name ].join(' '));
                
                  // Search item
                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 autoEnableValidators has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                Config.prototype.autoEnableValidators = function (items) {
                  // Is valid format ?
                  if (!_.isArray(items) || _.isEmpty(items)) {
                    // Warn message invalid data
                    this.logger.warning([ '[ Config.autoEnableValidator ] - Cannot check items.',
                Severity: Minor
                Found in src/index.js - About 45 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 set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                Config.prototype.set = function (name, value) {
                  // Check requirements
                  if (!_.isUndefined(name) && _.isString(name) && !_.isEmpty(name)) {
                    // Need to normalize path ?
                    if (name === 'base') {
                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