multiplex/multiplex.js

View on GitHub

Showing 109 of 109 total issues

Function iterableCount has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export default function iterableCount(value, predicate) {
    var count = 0;

    if (!predicate) {
        count = collectionCount(value);
Severity: Minor
Found in src/lib/utils/count.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 forOf has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export default function forOf(source, action) {
    var arr = asArray(source);

    // fast array iteration
    if (arr) {
Severity: Minor
Found in src/lib/utils/for-of.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 quickSort has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    quickSort: function (map, left, right) {
        do {
            var i = left,
                j = right,
                x = map[i + ((j - i) >> 1)];
Severity: Minor
Found in src/lib/collections/ordered-iterable.js - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

            if (
                (objA instanceof Date && objB instanceof Date) ||
                (objA instanceof Number && objB instanceof Number) ||
                (objA instanceof String && objB instanceof String) ||
                (objA instanceof Boolean && objB instanceof Boolean)) {
    Severity: Critical
    Found in src/lib/runtime/equals.js - About 1 hr to fix

      Function insert has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          insert: function (key, value, add) {
              var comparer = this.comparer,
                  hash = comparer.hash(key) & 0x7FFFFFFF,
                  bucket = hash % this.buckets.length,
                  slot = null,
      Severity: Minor
      Found in src/lib/collections/hash-table.js - About 1 hr to fix

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

            getGrouping: function (key, value, create) {
                var comparer = this.comparer,
                    hash = comparer.hash(key) & 0x7FFFFFFF,
                    bucket = hash % this.buckets.length,
                    index = this.buckets[bucket],
        Severity: Minor
        Found in src/lib/collections/lookup-table.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 isArrayLike has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function isArrayLike(obj) {
            // - Array
            // - String
            //
            // - Typed arrays:
        Severity: Minor
        Found in src/lib/utils/is-array-like.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 remove has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            remove: function (value) {
                var node;
        
                if (value instanceof LinkedListNode) {
                    node = value;
        Severity: Minor
        Found in src/lib/collections/linked-list.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 singleOrDefaultIterator has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function singleOrDefaultIterator(source, predicate, defaultValue) {
            assertNotNull(source);
            predicate = predicate || trueFunction;
            assertType(predicate, Function);
        
        
        Severity: Minor
        Found in src/lib/linq/single-or-default.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 linq has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function linq(iterable) {
            mixin(iterable, {
        
                /**
                * Returns an empty Iterable.
        Severity: Minor
        Found in src/lib/linq/_linq.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 getGrouping has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            getGrouping: function (key, value, create) {
                var comparer = this.comparer,
                    hash = comparer.hash(key) & 0x7FFFFFFF,
                    bucket = hash % this.buckets.length,
                    index = this.buckets[bucket],
        Severity: Minor
        Found in src/lib/collections/lookup-table.js - About 1 hr to fix

          Function compute31BitNumberHash has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function compute31BitNumberHash(val) {
              var h = 0;
          
              // integer number
              if (val <= MAX_SAFE_INTEGER && val >= MIN_SAFE_INTEGER && val % 1 === 0) {
          Severity: Minor
          Found in src/lib/runtime/hash-number.js - About 1 hr to fix

            Function joinIterator has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function joinIterator(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) {
                assertNotNull(inner);
                assertType(outerKeySelector, Function);
                assertType(innerKeySelector, Function);
                assertType(resultSelector, Function);
            Severity: Minor
            Found in src/lib/linq/join.js - About 1 hr to fix

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

              export default function selectManyIterator(source, collectionSelector, resultSelector) {
                  assertNotNull(source);
                  assertType(collectionSelector, Function);
                  if (resultSelector) {
                      assertType(resultSelector, Function);
              Severity: Minor
              Found in src/lib/linq/select-many.js - About 1 hr to fix

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

                export default function singleOrDefaultIterator(source, predicate, defaultValue) {
                    assertNotNull(source);
                    predicate = predicate || trueFunction;
                    assertType(predicate, Function);
                
                
                Severity: Minor
                Found in src/lib/linq/single-or-default.js - About 1 hr to fix

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

                  export default function hash(obj, strict) {
                      // null/undefined hash is 0
                      if (obj === null || obj === undefined) {
                          return 0;
                      }
                  Severity: Minor
                  Found in src/lib/runtime/hash.js - About 1 hr to fix

                    Similar blocks of code found in 3 locations. Consider refactoring.
                    Open

                    export default function lastIterator(source, predicate) {
                        var value = {},
                            result = lastOrDefault(source, predicate, value);
                    
                        if (result === value) {
                    Severity: Major
                    Found in src/lib/linq/last.js and 2 other locations - About 1 hr to fix
                    src/lib/linq/first.js on lines 4..13
                    src/lib/linq/single.js on lines 4..13

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 58.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 3 locations. Consider refactoring.
                    Open

                    export default function singleIterator(source, predicate) {
                        var value = {},
                            result = singleOrDefault(source, predicate, value);
                    
                        if (result === value) {
                    Severity: Major
                    Found in src/lib/linq/single.js and 2 other locations - About 1 hr to fix
                    src/lib/linq/first.js on lines 4..13
                    src/lib/linq/last.js on lines 4..13

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 58.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 3 locations. Consider refactoring.
                    Open

                    export default function firstIterator(source, predicate) {
                        var value = {},
                            result = firstOrDefault(source, predicate, value);
                    
                        if (result === value) {
                    Severity: Major
                    Found in src/lib/linq/first.js and 2 other locations - About 1 hr to fix
                    src/lib/linq/last.js on lines 4..13
                    src/lib/linq/single.js on lines 4..13

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 58.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Function equals has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function equals(objA, objB, strict) {
                        // Objects are identical
                        if (objA === objB) {
                            return true;
                        }
                    Severity: Minor
                    Found in src/lib/runtime/equals.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language