jashkenas/underscore

View on GitHub

Showing 115 of 117 total issues

Avoid too many return statements within this function.
Open

      if (keys(b).length !== length) return false;
Severity: Major
Found in underscore-umd.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        if (aStack[length] === a) return bStack[length] === b;
    Severity: Major
    Found in underscore-esm.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return true;
      Severity: Major
      Found in underscore-umd.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              if (!eq(a[length], b[length], aStack, bStack)) return false;
        Severity: Major
        Found in underscore-esm.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            return true;
          Severity: Major
          Found in underscore-esm.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return false;
            Severity: Major
            Found in underscore.js - About 30 mins to fix

              Function range has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export default function range(start, stop, step) {
                if (stop == null) {
                  stop = start || 0;
                  start = 0;
                }
              Severity: Minor
              Found in modules/range.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

              Function keys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export default function keys(obj) {
                if (!isObject(obj)) return [];
                if (nativeKeys) return nativeKeys(obj);
                var keys = [];
                for (var key in obj) if (has(obj, key)) keys.push(key);
              Severity: Minor
              Found in modules/keys.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

              Function collectNonEnumProps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              function collectNonEnumProps(obj, keys) {
                keys = emulatedSet(keys);
                var nonEnumIdx = nonEnumerableProps.length;
                var constructor = obj.constructor;
                var proto = (isFunction$1(constructor) && constructor.prototype) || ObjProto;
              Severity: Minor
              Found in underscore-esm.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

              Function last has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export default function last(array, n, guard) {
                if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
                if (n == null || guard) return array[array.length - 1];
                return rest(array, Math.max(0, array.length - n));
              }
              Severity: Minor
              Found in modules/last.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

              Function each has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              function each(obj, iteratee, context) {
                iteratee = optimizeCb(iteratee, context);
                var i, length;
                if (isArrayLike(obj)) {
                  for (i = 0, length = obj.length; i < length; i++) {
              Severity: Minor
              Found in underscore-esm.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

              Function first has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export default function first(array, n, guard) {
                if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
                if (n == null || guard) return array[0];
                return initial(array, array.length - n);
              }
              Severity: Minor
              Found in modules/first.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

              Function each has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export default function each(obj, iteratee, context) {
                iteratee = optimizeCb(iteratee, context);
                var i, length;
                if (isArrayLike(obj)) {
                  for (i = 0, length = obj.length; i < length; i++) {
              Severity: Minor
              Found in modules/each.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

              Function keys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              function keys(obj) {
                if (!isObject(obj)) return [];
                if (nativeKeys) return nativeKeys(obj);
                var keys = [];
                for (var key in obj) if (has$1(obj, key)) keys.push(key);
              Severity: Minor
              Found in underscore-esm.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

              Function every has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              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 underscore-esm.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