jashkenas/underscore

View on GitHub

Showing 117 of 117 total issues

Function debounce has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function debounce(func, wait, immediate) {
  var timeout, previous, args, result, context;

  var later = function() {
    var passed = now() - previous;
Severity: Minor
Found in modules/debounce.js - About 1 hr to fix

    Function debounce has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function debounce(func, wait, immediate) {
        var timeout, previous, args, result, context;
    
        var later = function() {
          var passed = now() - previous;
    Severity: Minor
    Found in underscore.js - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

            if (aCtor !== bCtor && !(isFunction$1(aCtor) && aCtor instanceof aCtor &&
                                     isFunction$1(bCtor) && bCtor instanceof bCtor)
                                && ('constructor' in a && 'constructor' in b)) {
              return false;
            }
      Severity: Major
      Found in underscore.js - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

            if (aCtor !== bCtor && !(isFunction$1(aCtor) && aCtor instanceof aCtor &&
                                     isFunction$1(bCtor) && bCtor instanceof bCtor)
                                && ('constructor' in a && 'constructor' in b)) {
              return false;
            }
        Severity: Major
        Found in underscore-esm.js - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                if (aCtor !== bCtor && !(isFunction$1(aCtor) && aCtor instanceof aCtor &&
                                         isFunction$1(bCtor) && bCtor instanceof bCtor)
                                    && ('constructor' in a && 'constructor' in b)) {
                  return false;
                }
          Severity: Major
          Found in underscore-umd.js - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor &&
                                         isFunction(bCtor) && bCtor instanceof bCtor)
                                    && ('constructor' in a && 'constructor' in b)) {
                  return false;
                }
            Severity: Major
            Found in modules/isEqual.js - About 1 hr to fix

              Function template has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function template(text, settings, oldSettings) {
                if (!settings && oldSettings) settings = oldSettings;
                settings = defaults({}, settings, _$1.templateSettings);
              
                // Combine delimiters into one regular expression via alternation.
              Severity: Minor
              Found in underscore-esm.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 template has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              export default function template(text, settings, oldSettings) {
                if (!settings && oldSettings) settings = oldSettings;
                settings = defaults({}, settings, _.templateSettings);
              
                // Combine delimiters into one regular expression via alternation.
              Severity: Minor
              Found in modules/template.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 pick has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              var pick = restArguments(function(obj, keys) {
                var result = {}, iteratee = keys[0];
                if (obj == null) return result;
                if (isFunction$1(iteratee)) {
                  if (keys.length > 1) iteratee = optimizeCb(iteratee, keys[1]);
              Severity: Minor
              Found in underscore-esm.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 executeBound has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
              Severity: Minor
              Found in underscore-umd.js - About 35 mins to fix

                Function executeBound has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                export default function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
                Severity: Minor
                Found in modules/_executeBound.js - About 35 mins to fix

                  Function executeBound has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
                  Severity: Minor
                  Found in underscore.js - About 35 mins to fix

                    Function executeBound has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
                    Severity: Minor
                    Found in underscore-esm.js - About 35 mins to fix

                      Function partial has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      var partial = restArguments(function(func, boundArgs) {
                        var placeholder = partial.placeholder;
                        var bound = function() {
                          var position = 0, length = boundArgs.length;
                          var args = Array(length);
                      Severity: Minor
                      Found in underscore-esm.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 some has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export default function some(obj, predicate, context) {
                        predicate = cb(predicate, context);
                        var _keys = !isArrayLike(obj) && keys(obj),
                            length = (_keys || obj).length;
                        for (var index = 0; index < length; index++) {
                      Severity: Minor
                      Found in modules/some.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 eq has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function eq(a, b, aStack, bStack) {
                        // Identical objects are equal. `0 === -0`, but they aren't identical.
                        // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal).
                        if (a === b) return a !== 0 || 1 / a === 1 / b;
                        // `null` or `undefined` only equal to itself (strict comparison).
                      Severity: Minor
                      Found in modules/isEqual.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 collectNonEnumProps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export default function collectNonEnumProps(obj, keys) {
                        keys = emulatedSet(keys);
                        var nonEnumIdx = nonEnumerableProps.length;
                        var constructor = obj.constructor;
                        var proto = (isFunction(constructor) && constructor.prototype) || ObjProto;
                      Severity: Minor
                      Found in modules/_collectNonEnumProps.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 some has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function some(obj, predicate, context) {
                        predicate = cb(predicate, context);
                        var _keys = !isArrayLike(obj) && keys(obj),
                            length = (_keys || obj).length;
                        for (var index = 0; index < length; index++) {
                      Severity: Minor
                      Found in underscore-esm.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 partial has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      var partial = restArguments(function(func, boundArgs) {
                        var placeholder = partial.placeholder;
                        var bound = function() {
                          var position = 0, length = boundArgs.length;
                          var args = Array(length);
                      Severity: Minor
                      Found in modules/partial.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 every has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export default function every(obj, predicate, context) {
                        predicate = cb(predicate, context);
                        var _keys = !isArrayLike(obj) && keys(obj),
                            length = (_keys || obj).length;
                        for (var index = 0; index < length; index++) {
                      Severity: Minor
                      Found in modules/every.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

                      Severity
                      Category
                      Status
                      Source
                      Language