multiplex/multiplex.js

View on GitHub
src/lib/collections/hash-set.js

Summary

Maintainability
C
1 day
Test Coverage

File hash-set.js has 289 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Collection from './collection';
import HashTable, { HashTableIterator } from './hash-table';
import EqulityComparer from './equality-comparer';
import assertType from '../utils/assert-type';
import assertNotNull from '../utils/assert-not-null';
Severity: Minor
Found in src/lib/collections/hash-set.js - About 2 hrs to fix

    Function intersectWith has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        intersectWith: function (other) {
            assertNotNull(other);
    
            // intersection of anything with empty set is empty set, so return if count is 0
            if (this.count() === 0) {
    Severity: Minor
    Found in src/lib/collections/hash-set.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 isProperSupersetOf has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        isProperSupersetOf: function (other) {
            assertNotNull(other);
    
            // the empty set isn't a proper superset of any set.
            if (this.count() === 0) {
    Severity: Minor
    Found in src/lib/collections/hash-set.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 isProperSubsetOf has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        isProperSubsetOf: function (other) {
            assertNotNull(other);
    
            var c = collectionCount(other);
    
    
    Severity: Minor
    Found in src/lib/collections/hash-set.js - About 55 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 isSupersetOf has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        isSupersetOf: function (other) {
            assertNotNull(other);
    
            var c = collectionCount(other);
    
    
    Severity: Minor
    Found in src/lib/collections/hash-set.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

    Avoid too many return statements within this function.
    Open

            return (result.uniqueCount < this.count() && result.unfoundCount === 0);
    Severity: Major
    Found in src/lib/collections/hash-set.js - About 30 mins to fix

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

          setEquals: function (other) {
              assertNotNull(other);
      
              if (areEqualityComparersEqual(this, other)) {
                  if (this.count() !== other.count()) {
      Severity: Minor
      Found in src/lib/collections/hash-set.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

      There are no issues that match your filters.

      Category
      Status