krachot/options-resolver

View on GitHub

Showing 12 of 36 total issues

Function createResolver has a Cognitive Complexity of 160 (exceeds 5 allowed). Consider refactoring.
Open

function createResolver() {
  var state = {
    defined: {},
    defaults: {},
    required: {},
Severity: Minor
Found in lib/createResolver.js - About 3 days 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 createResolver has a Cognitive Complexity of 117 (exceeds 5 allowed). Consider refactoring.
Open

export default function createResolver() {
  var state = {
    defined: {},
    defaults: {},
    required: {},
Severity: Minor
Found in src/createResolver.js - About 2 days 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 createResolver has 423 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createResolver() {
  var state = {
    defined: {},
    defaults: {},
    required: {},
Severity: Major
Found in lib/createResolver.js - About 2 days to fix

    Function createResolver has 314 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function createResolver() {
      var state = {
        defined: {},
        defaults: {},
        required: {},
    Severity: Major
    Found in src/createResolver.js - About 1 day to fix

      File createResolver.js has 441 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      'use strict';
      
      Object.defineProperty(exports, "__esModule", {
        value: true
      });
      Severity: Minor
      Found in lib/createResolver.js - About 6 hrs to fix

        Function get has 111 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function get(option) {
            if (!clone.locked) {
              throw new Error('get is only supported within closures of lazy options and normalizers.');
            }
        
        
        Severity: Major
        Found in lib/createResolver.js - About 4 hrs to fix

          File createResolver.js has 320 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import difference from 'lodash/array/difference';
          import { merge, omit } from 'lodash/object';
          import lang from 'lodash/lang';
          import sortBy from 'lodash/collection/sortBy';
          
          
          Severity: Minor
          Found in src/createResolver.js - About 3 hrs to fix

            Function get has 76 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function get(option) {
                if (!clone.locked) {
                  throw new Error('get is only supported within closures of lazy options and normalizers.');
                }
            
            
            Severity: Major
            Found in src/createResolver.js - About 3 hrs to fix

              Function resolve has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function resolve() {
                  var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
              
                  return new Promise(function (resolve, reject) {
                    if (state.locked) {
              Severity: Minor
              Found in lib/createResolver.js - About 2 hrs to fix

                Function setRequired has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function setRequired(optionNames) {
                    if (state.locked) {
                      throw new Error('Options cannot be made required from a lazy option or normalizer.');
                    }
                
                
                Severity: Minor
                Found in lib/createResolver.js - About 1 hr to fix

                  Function resolve has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function resolve(options = {}) {
                      return new Promise((resolve, reject) => {
                        if (state.locked) {
                          const err = new Error('Options cannot be state.resolved from a lazy option or normalizer.');
                          return reject(err);
                  Severity: Minor
                  Found in src/createResolver.js - About 1 hr to fix

                    Function setDefined has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function setDefined(optionNames) {
                        if (state.locked) {
                          throw new Error('Options cannot be defined from a lazy option or normalizer.');
                        }
                    
                    
                    Severity: Minor
                    Found in lib/createResolver.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language