JoeKarlsson/data-structures

View on GitHub

Showing 32 of 50 total issues

Function bubbleModule has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const bubbleModule = (() => {
const swap = ( arr, i1, i2) => {
const tmp = arr[i1];
arr[i1] = arr[i2];
arr[i2] = tmp;
Severity: Minor
Found in sorting/bubblesort.js - About 55 mins to fix

Function insert has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

insert(currentNode) {
const value = currentNode.value;
 
const traverse = (node) => {
if (value > node.value) {
Severity: Minor
Found in search/binary-search-tree.js - About 55 mins to fix

Function FFT_2_Iterative has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function FFT_2_Iterative(input, inverse) {
const n = input.length;
 
const output = BitReverseComplexArray(input);
const output_r = output.real;
Severity: Minor
Found in fast-fourier-transforms/fft.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

if (
neighbor.h < closestNode.h ||
(neighbor.h === closestNode.h && neighbor.g < closestNode.g)
) {
closestNode = neighbor;
Severity: Major
Found in shortest-path/aStar.js - About 45 mins to fix

    Function dfs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const dfs = (start, searchFor) => {
    if (!searchFor || !start) {
    throw new Error('Invalid input');
    }
     
     
    Severity: Minor
    Found in graph-traversing/depth-first-search-recursive.js - About 35 mins to fix

    Function getDepth has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    getDepth() {
    let maxDepth = 0;
    const node = this.root;
    const traverse = (node, depth) => {
    if ( !node ) return null;
    Severity: Minor
    Found in search/binary-search-tree.js - About 35 mins to fix

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

    const DFS = (start, searchFor) => {
    const stack = [start];
    const visited = [];
    let currNode = start;
     
     
    Severity: Minor
    Found in graph-traversing/depth-first-search-imperative.js - About 25 mins to fix

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

    countLeaves() {
    let count = 0;
    const node = this.root;
    const traverse = ( node ) => {
    if ( !node) {
    Severity: Minor
    Found in search/binary-search-tree.js - About 25 mins to fix

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

    reduce(callbackFn, startingValue, extractValues = true) {
    let currentNode;
    let accumulated;
     
    let extractorFn;
    Severity: Minor
    Found in list/list.js - About 25 mins to fix

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

    contains(value) {
    const node = this.root;
    const traverse = ( node ) => {
    if (!node) {
    return false;
    Severity: Minor
    Found in search/binary-search-tree.js - About 25 mins to fix

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

    const searchRabinKarp = ( text, str ) => {
    const matches = [];
     
    const hashStr = hashFromTo(str, 0, str.length); // hash the substring
    const primeToPower = Math.pow(primeBase, str.length);
    Severity: Minor
    Found in rabin-karp/rk.js - About 25 mins to fix

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

    const insertionModule = (() => {
    // swap method because its used multiple times
    const swap = ( array, index1, index2 ) => {
    // store a tmp variable at pos index2
    const tmp = array[index2];
    Severity: Minor
    Found in sorting/insertionsort.js - About 25 mins to fix
    Severity
    Category
    Status
    Source
    Language