pat310/quick-pivot

View on GitHub

Showing 19 of 119 total issues

Function tableCreator has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
Open

export function tableCreator(data, rows = [], cols = [], accCatOrCB,
  accTypeOrInitVal, rowHeader, columnSortFunc) {

  /** if data is empty, return empty array */
  if (data.length === 0) {
Severity: Minor
Found in src/logic.js - About 1 day 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 tableCreator has 205 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function tableCreator(data, rows = [], cols = [], accCatOrCB,
  accTypeOrInitVal, rowHeader, columnSortFunc) {

  /** if data is empty, return empty array */
  if (data.length === 0) {
Severity: Major
Found in src/logic.js - About 1 day to fix

    File tableCreator.js has 358 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { expect } from 'chai';
    import { tableCreator } from '../../src/logic.js';
    
    const data = [
      {name: 'patrick', borough: 'brooklyn', age: '28', gender: 'm'},
    Severity: Minor
    Found in test/logic/tableCreator.js - About 4 hrs to fix

      File logic.js has 355 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /**
       * @file Contains logic to actually pivot data
      */
      
      /**
      Severity: Minor
      Found in src/logic.js - About 4 hrs to fix

        File filter.js has 302 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { expect } from 'chai';
        import Pivot from '../../src';
        
        const dataArray = [
         ['name', 'gender', 'house', 'age'],
        Severity: Minor
        Found in test/index/filter.js - About 3 hrs to fix

          Function rowRecurse has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function rowRecurse(rowGroups, depth, rowHeaders = []) {
              for (const key in rowGroups) {
                if (Array.isArray(rowGroups[key])) {
                  const recursedData = groupByCategories(rowGroups[key], cols);
          
          
          Severity: Major
          Found in src/logic.js - About 2 hrs to fix

            File expand.js has 255 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { expect } from 'chai';
            import Pivot from '../../src';
            
            const dataArray = [
              ['name', 'gender', 'house', 'age'],
            Severity: Minor
            Found in test/index/expand.js - About 2 hrs to fix

              Function fixDataFormat has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function fixDataFormat(data, rows = [], sortFunc) {
                if (!Array.isArray(data) || !data.length) return [];
              
                let formattedData = [];
              
              
              Severity: Minor
              Found in src/logic.js - About 1 hr to fix

                Function recurseThroughMap has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        (function recurseThroughMap(dataPos, map) {
                          if (Array.isArray(dataPos)) {
                            if (key === prevKey) {
                              const datum = dataRows[dataRows.length - 1].value;
                
                
                Severity: Minor
                Found in src/logic.js - About 1 hr to fix

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

                  export function accumulator(arr, accCat, accType, accValue) {
                    if (typeof accCat === 'undefined') accType = 'count';
                    else if (typeof accCat === 'function') accValue = accType || 0;
                  
                    return arr.reduce((acc, curr, index, array) => {
                  Severity: Minor
                  Found in src/logic.js - About 1 hr to fix

                    Function filter has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      filter(fieldName, filterValues, filterType) {
                        /** check that the parameters are of allowed type */
                        if ((typeof fieldName === 'function') ||
                          (typeof fieldName === 'string' && Array.isArray(filterValues))) {
                          /** filter out the data set based on the parameters*/
                    Severity: Minor
                    Found in src/index.js - About 1 hr to fix

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

                      export function createColumnHeaders(
                        data,
                        cols = [],
                        firstColumn = '',
                        columnSortFunc = () => () => {}
                      Severity: Minor
                      Found in src/logic.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 collapse has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function collapse(rowNum, data) {
                        /** get the current row, row type, and row depth */
                        const selectedRow = data.table[rowNum];
                        const {type, depth} = selectedRow;
                      
                      
                      Severity: Minor
                      Found in src/progressiveDiscovery.js - About 1 hr to fix

                        Function fixDataFormat has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function fixDataFormat(data, rows = [], sortFunc) {
                          if (!Array.isArray(data) || !data.length) return [];
                        
                          let formattedData = [];
                        
                        
                        Severity: Minor
                        Found in src/logic.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 tableCreator has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        export function tableCreator(data, rows = [], cols = [], accCatOrCB,
                          accTypeOrInitVal, rowHeader, columnSortFunc) {
                        Severity: Major
                        Found in src/logic.js - About 50 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return acc;
                          Severity: Major
                          Found in src/logic.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return acc;
                            Severity: Major
                            Found in src/logic.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return acc;
                              Severity: Major
                              Found in src/logic.js - About 30 mins to fix

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

                                export function collapse(rowNum, data) {
                                  /** get the current row, row type, and row depth */
                                  const selectedRow = data.table[rowNum];
                                  const {type, depth} = selectedRow;
                                
                                
                                Severity: Minor
                                Found in src/progressiveDiscovery.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

                                Severity
                                Category
                                Status
                                Source
                                Language