benjamine/jsondiffpatch

View on GitHub

Showing 93 of 156 total issues

File diffpatch.js has 1341 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const examples = {};

const exampleDate = () => new Date(2020, 10, 30, 15, 10, 3);

/* jshint camelcase: false */
Severity: Major
Found in test/examples/diffpatch.js - About 3 days to fix

    Function demo has 672 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    (function demo() {
      const getExampleJson = function() {
        const data = {
          name: 'South America',
          summary:
    Severity: Major
    Found in docs/demo/demo.js - About 3 days to fix

      Function demo has a Cognitive Complexity of 157 (exceeds 5 allowed). Consider refactoring.
      Open

      (function demo() {
        const getExampleJson = function() {
          const data = {
            name: 'South America',
            summary:
      Severity: Minor
      Found in docs/demo/demo.js - About 3 days 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

      File demo.js has 674 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      (function demo() {
        const getExampleJson = function() {
          const data = {
            name: 'South America',
            summary:
      Severity: Major
      Found in docs/demo/demo.js - About 1 day to fix

        File index.js has 661 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*
         * mocha's bdd syntax is inspired in RSpec
         *   please read: http://betterspecs.org/
         */
        import * as jsondiffpatch from '../build/jsondiffpatch.esm';
        Severity: Major
        Found in test/index.js - About 1 day to fix

          Function arraysDiffFilter has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
          Open

          export const diffFilter = function arraysDiffFilter(context) {
            if (!context.leftIsArray) {
              return;
            }
          
          
          Severity: Minor
          Found in src/filters/arrays.js - About 6 hrs 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 arraysDiffFilter has 161 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const diffFilter = function arraysDiffFilter(context) {
            if (!context.leftIsArray) {
              return;
            }
          
          
          Severity: Major
          Found in src/filters/arrays.js - About 6 hrs to fix

            File arrays.js has 432 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import DiffContext from '../contexts/diff';
            import PatchContext from '../contexts/patch';
            import ReverseContext from '../contexts/reverse';
            
            import lcs from './lcs';
            Severity: Minor
            Found in src/filters/arrays.js - About 6 hrs to fix

              Function getExampleJson has 147 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const getExampleJson = function() {
                  const data = {
                    name: 'South America',
                    summary:
                      'South America (Spanish: América del Sur, Sudamérica or  \n' +
              Severity: Major
              Found in docs/demo/demo.js - About 5 hrs to fix

                Function forEachDeltaKey has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                Open

                  forEachDeltaKey(delta, left, fn) {
                    const keys = getObjectKeys(delta);
                    const arrayKeys = delta._t === 'a';
                    const moveDestinations = {};
                    let name;
                Severity: Minor
                Found in src/formatters/base.js - About 5 hrs 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 nestedPatchFilter has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                Open

                export const patchFilter = function nestedPatchFilter(context) {
                  if (!context.nested) {
                    return;
                  }
                  if (context.delta._t !== 'a') {
                Severity: Minor
                Found in src/filters/arrays.js - About 4 hrs 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 reverseArrayDeltaIndex has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                let reverseArrayDeltaIndex = (delta, index, itemDelta) => {
                  if (typeof index === 'string' && index[0] === '_') {
                    return parseInt(index.substr(1), 10);
                  } else if (isArray(itemDelta) && itemDelta[2] === 0) {
                    return `_${index}`;
                Severity: Minor
                Found in src/filters/arrays.js - About 3 hrs 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 getDiffMatchPatch has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                let getDiffMatchPatch = function(required) {
                  /* jshint camelcase: false */
                
                  if (!cachedDiffPatch) {
                    let instance;
                Severity: Minor
                Found in src/filters/texts.js - About 3 hrs 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 nestedPatchFilter has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const patchFilter = function nestedPatchFilter(context) {
                  if (!context.nested) {
                    return;
                  }
                  if (context.delta._t !== 'a') {
                Severity: Major
                Found in src/filters/arrays.js - About 2 hrs to fix

                  Function compare has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    const compare = function() {
                      let left, right, error;
                      document.getElementById('results').style.display = 'none';
                      try {
                        left = areas.left.parse();
                  Severity: Major
                  Found in docs/demo/demo.js - About 2 hrs to fix

                    Function trivialMatchesDiffFilter has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const diffFilter = function trivialMatchesDiffFilter(context) {
                      if (context.left === context.right) {
                        context.setResult(undefined).exit();
                        return;
                      }
                    Severity: Minor
                    Found in src/filters/trivial.js - About 2 hrs 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

                    File html.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import BaseFormatter from './base';
                    
                    class HtmlFormatter extends BaseFormatter {
                      typeFormattterErrorFormatter(context, err) {
                        context.out(`<pre class="jsondiffpatch-error">${err}</pre>`);
                    Severity: Minor
                    Found in src/formatters/html.js - About 2 hrs to fix

                      Function objectsDiffFilter has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function objectsDiffFilter(context) {
                        if (context.leftIsArray || context.leftType !== 'object') {
                          return;
                        }
                      
                      
                      Severity: Minor
                      Found in src/filters/nested.js - About 2 hrs 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 leftright has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        load.leftright = function(descriptionArg, leftValueArg, rightValueArg) {
                          try {
                            const description = decodeURIComponent(descriptionArg || '');
                            const leftValue = decodeURIComponent(leftValueArg);
                            const rightValue = decodeURIComponent(rightValueArg);
                      Severity: Major
                      Found in docs/demo/demo.js - About 2 hrs to fix

                        Function matchItems has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function matchItems(array1, array2, index1, index2, context) {
                          let value1 = array1[index1];
                          let value2 = array2[index2];
                          if (value1 === value2) {
                            return true;
                        Severity: Minor
                        Found in src/filters/arrays.js - About 2 hrs 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