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';
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) {
- Read upRead up
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) {
- Read upRead up
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);
- Read upRead up
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);
- Read upRead up
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);
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()) {
- Read upRead up
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"