sularome/JavaScript-Algorithms

View on GitHub

Showing 30 of 30 total issues

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

    contains(word: string) {
        let currentNode: RadixTreeNode<T> = this.root;
        let cumulatedWord: string = "";

        while (currentNode !== null && !currentNode.isLeaf() && cumulatedWord.length <= word.length) {
Severity: Minor
Found in ts/RadixTree.ts - 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 contains has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public contains(word: string) {
        const wordwSize = word.length;
        let i: number = 0;
        let level = this.root;
        while (i < wordwSize) {
Severity: Minor
Found in ts/TrieWithValue.ts - 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 successor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public successor (value: T) {
        let node = this.search(value);
        let ancestor: RedBlackTreeNode<T>;
        if (node === null || value === null) {
            return null;
Severity: Minor
Found in ts/BinaryTree/RedBlackTree.ts - 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 get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    get(word: string) {
        let currentNode: RadixTreeNode<T> = this.root;
        let cumulatedWord: string = "";

        while (currentNode !== null && !currentNode.isLeaf() && cumulatedWord.length <= word.length) {
Severity: Minor
Found in ts/RadixTree.ts - 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 contains has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public contains(word: string) {
        const wordwSize = word.length;
        let i: number = 0;
        let level = this.root;
        while (i < wordwSize) {
Severity: Minor
Found in ts/Trie.ts - 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 FindMaximumCrossingSubarray has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function FindMaximumCrossingSubarray (array: number[], left: number, middle: number, right: number) {
    let leftSum: number = -Infinity;
    let rightSum: number = -Infinity;
    let sum: number = 0;
    let maxLeft: number = middle;
Severity: Minor
Found in ts/FindMaximumSubarray.ts - 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 remove has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public remove(value: T) {
        let node: IBinaryTreeNode<T> = this.search(value);
        if (node === null) {
            return false;
        }
Severity: Minor
Found in ts/BinaryTree/BinaryTree.ts - 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 search has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public search(value: T): RedBlackTreeNode<T> {
        let currentNode: RedBlackTreeNode<T> = this.root;
        while (currentNode !== this.sentinel && currentNode.value !== value) {
            if (this.comparator(currentNode.value, value)) {
                currentNode = currentNode.left;
Severity: Minor
Found in ts/BinaryTree/RedBlackTree.ts - 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

TODO found
Open

// TODO: add delete and getWordsFromPrefix
Severity: Minor
Found in ts/TrieWithValue.ts by fixme

TODO found
Open

// TODO: getWordsFromPrefix
Severity: Minor
Found in ts/Trie.ts by fixme
Severity
Category
Status
Source
Language