pat310/quick-pivot

View on GitHub

Showing 119 of 119 total issues

Identical blocks of code found in 9 locations. Consider refactoring.
Open

const dataArray = [
 ['name', 'gender', 'house', 'age'],
 ['Jon', 'm', 'Stark', 14],
 ['Arya', 'f', 'Stark', 10],
 ['Cersei', 'f', 'Baratheon', 38],
Severity: Major
Found in test/index/filter.js and 8 other locations - About 1 hr to fix
test/index/collapse.js on lines 4..15
test/index/collapseAll.js on lines 4..15
test/index/constructor.js on lines 4..15
test/index/expand.js on lines 4..15
test/index/expandAll.js on lines 4..15
test/index/getData.js on lines 4..15
test/index/getUniqueValues.js on lines 4..15
test/index/toggle.js on lines 4..15

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 68.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            case ('min'): {
              if (index === 0) acc = Number(curr[accCat]);
              else if (curr[accCat] < acc) acc = Number(curr[accCat]);
      
              return acc;
      Severity: Major
      Found in src/logic.js and 1 other location - About 1 hr to fix
      src/logic.js on lines 207..212

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 61.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            case ('max'): {
              if (index === 0) acc = Number(curr[accCat]);
              else if (curr[accCat] > acc) acc = Number(curr[accCat]);
      
              return acc;
      Severity: Major
      Found in src/logic.js and 1 other location - About 1 hr to fix
      src/logic.js on lines 200..205

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 61.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            it('should return an empty array if including on a dimension that does not ' +
              'exist', () => {
              const results = filter(data, 'dogman', ['dogman'], 'include');
          
              expect(results).to.deep.equal([]);
          Severity: Major
          Found in test/filtering/filter.js and 1 other location - About 1 hr to fix
          test/filtering/filter.js on lines 119..124

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 57.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            it('should return an empty array if including a value that does not ' +
              'exist', () => {
              const results = filter(data, 'gender', ['dogman'], 'include');
          
              expect(results).to.deep.equal([]);
          Severity: Major
          Found in test/filtering/filter.js and 1 other location - About 1 hr to fix
          test/filtering/filter.js on lines 133..138

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 57.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                    value: [
                      'f',
                      [
                        {name: 'jessica', borough: 'brooklyn', age: '28', gender: 'f'},
                      ],
          Severity: Major
          Found in test/logic/tableCreator.js and 1 other location - About 1 hr to fix
          test/logic/tableCreator.js on lines 100..114

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 56.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                      value: [
                        'f',
                        [
                          {
                            name: 'jessica',
          Severity: Major
          Found in test/logic/tableCreator.js and 1 other location - About 1 hr to fix
          test/logic/tableCreator.js on lines 189..198

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 56.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            it('should return all values if excluding on a dimension that does not ' +
              'exist', () => {
              const results = filter(data, 'dogman', ['dogman'], 'exclude');
          
              expect(results).to.deep.equal(data);
          Severity: Major
          Found in test/filtering/filter.js and 1 other location - About 1 hr to fix
          test/filtering/filter.js on lines 126..131

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 56.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            it('should be chainable', () => {
              const pivot = create();
          
              const result = pivot.collapseAll();
          
          
          Severity: Major
          Found in test/index/collapseAll.js and 1 other location - About 1 hr to fix
          test/index/expandAll.js on lines 81..87

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 56.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            it('should be chainable', () => {
              const pivot = create();
          
              const result = pivot.expandAll();
          
          
          Severity: Major
          Found in test/index/expandAll.js and 1 other location - About 1 hr to fix
          test/index/collapseAll.js on lines 61..67

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 56.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            it('should return all values if excluding a value that does not ' +
              'exist', () => {
              const results = filter(data, 'gender', ['dogman'], 'exclude');
          
              expect(results).to.deep.equal(data);
          Severity: Major
          Found in test/filtering/filter.js and 1 other location - About 1 hr to fix
          test/filtering/filter.js on lines 140..145

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 56.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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

            Similar blocks of code found in 10 locations. Consider refactoring.
            Open

                  { value: [
                    'Arya',
                    [ { name: 'Arya', gender: 'f', house: 'Stark', age: 10 } ],
                    '',
                    '',
            Severity: Major
            Found in test/index/getData.js and 9 other locations - About 30 mins to fix
            test/index/collapse.js on lines 77..84
            test/index/collapse.js on lines 93..100
            test/index/expand.js on lines 114..121
            test/index/expand.js on lines 138..145
            test/index/expandAll.js on lines 39..39
            test/index/expandAll.js on lines 41..41
            test/index/expandAll.js on lines 43..43
            test/index/expandAll.js on lines 46..46
            test/index/getData.js on lines 50..57

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 45.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 6 locations. Consider refactoring.
            Open

                  { value: [
                    'Jaime',
                    '',
                    '',
                    [ { name: 'Jaime', gender: 'm', house: 'Lannister', age: 32 } ],
            Severity: Major
            Found in test/index/expand.js and 5 other locations - About 30 mins to fix
            test/index/expand.js on lines 146..153
            test/index/expand.js on lines 154..161
            test/index/expandAll.js on lines 44..44
            test/index/expandAll.js on lines 47..47
            test/index/expandAll.js on lines 48..48

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 45.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language