meteor/meteor

View on GitHub
packages/test-in-browser/diff_match_patch_uncompressed.js

Summary

Maintainability
F
3 wks
Test Coverage

File diff_match_patch_uncompressed.js has 1453 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Diff Match and Patch
 * Copyright 2018 The diff-match-patch Authors.
 * https://github.com/google/diff-match-patch
 *
Severity: Major
Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 3 days to fix

    Function diff_bisect_ has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
    Open

    diff_match_patch.prototype.diff_bisect_ = function(text1, text2, deadline) {
      // Cache the text lengths to prevent multiple calls.
      var text1_length = text1.length;
      var text2_length = text2.length;
      var max_d = Math.ceil((text1_length + text2_length) / 2);
    Severity: Minor
    Found in packages/test-in-browser/diff_match_patch_uncompressed.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 patch_apply has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
    Open

    diff_match_patch.prototype.patch_apply = function(patches, text) {
      if (patches.length == 0) {
        return [text, []];
      }
    
    
    Severity: Minor
    Found in packages/test-in-browser/diff_match_patch_uncompressed.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 diff_cleanupMerge has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
    Open

    diff_match_patch.prototype.diff_cleanupMerge = function(diffs) {
      // Add a dummy entry at the end.
      diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, ''));
      var pointer = 0;
      var count_delete = 0;
    Severity: Minor
    Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 7 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 patch_splitMax has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

    diff_match_patch.prototype.patch_splitMax = function(patches) {
      var patch_size = this.Match_MaxBits;
      for (var x = 0; x < patches.length; x++) {
        if (patches[x].length1 <= patch_size) {
          continue;
    Severity: Minor
    Found in packages/test-in-browser/diff_match_patch_uncompressed.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 diff_cleanupSemanticLossless has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

    diff_match_patch.prototype.diff_cleanupSemanticLossless = function(diffs) {
      /**
       * Given two strings, compute a score representing whether the internal
       * boundary falls on logical boundaries.
       * Scores range from 6 (best) to 0 (worst).
    Severity: Minor
    Found in packages/test-in-browser/diff_match_patch_uncompressed.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 match_bitap_ has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

    diff_match_patch.prototype.match_bitap_ = function(text, pattern, loc) {
      if (pattern.length > this.Match_MaxBits) {
        throw new Error('Pattern too long for this browser.');
      }
    
    
    Severity: Minor
    Found in packages/test-in-browser/diff_match_patch_uncompressed.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 diff_cleanupSemantic has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {
      var changes = false;
      var equalities = [];  // Stack of indices where equalities are found.
      var equalitiesLength = 0;  // Keeping our own length var is faster in JS.
      /** @type {?string} */
    Severity: Minor
    Found in packages/test-in-browser/diff_match_patch_uncompressed.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 diff_cleanupEfficiency has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    diff_match_patch.prototype.diff_cleanupEfficiency = function(diffs) {
      var changes = false;
      var equalities = [];  // Stack of indices where equalities are found.
      var equalitiesLength = 0;  // Keeping our own length var is faster in JS.
      /** @type {?string} */
    Severity: Minor
    Found in packages/test-in-browser/diff_match_patch_uncompressed.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 diff_cleanupMerge has 104 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    diff_match_patch.prototype.diff_cleanupMerge = function(diffs) {
      // Add a dummy entry at the end.
      diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, ''));
      var pointer = 0;
      var count_delete = 0;
    Severity: Major
    Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 4 hrs to fix

      Function patch_make has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

      diff_match_patch.prototype.patch_make = function(a, opt_b, opt_c) {
        var text1, diffs;
        if (typeof a == 'string' && typeof opt_b == 'string' &&
            typeof opt_c == 'undefined') {
          // Method 1: text1, text2
      Severity: Minor
      Found in packages/test-in-browser/diff_match_patch_uncompressed.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 patch_fromText has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

      diff_match_patch.prototype.patch_fromText = function(textline) {
        var patches = [];
        if (!textline) {
          return patches;
        }
      Severity: Minor
      Found in packages/test-in-browser/diff_match_patch_uncompressed.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 diff_bisect_ has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      diff_match_patch.prototype.diff_bisect_ = function(text1, text2, deadline) {
        // Cache the text lengths to prevent multiple calls.
        var text1_length = text1.length;
        var text2_length = text2.length;
        var max_d = Math.ceil((text1_length + text2_length) / 2);
      Severity: Major
      Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 3 hrs to fix

        Function diff_cleanupSemantic has 83 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {
          var changes = false;
          var equalities = [];  // Stack of indices where equalities are found.
          var equalitiesLength = 0;  // Keeping our own length var is faster in JS.
          /** @type {?string} */
        Severity: Major
        Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 3 hrs to fix

          Function diff_cleanupSemanticLossless has 83 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          diff_match_patch.prototype.diff_cleanupSemanticLossless = function(diffs) {
            /**
             * Given two strings, compute a score representing whether the internal
             * boundary falls on logical boundaries.
             * Scores range from 6 (best) to 0 (worst).
          Severity: Major
          Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 3 hrs to fix

            Function patch_make has 78 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            diff_match_patch.prototype.patch_make = function(a, opt_b, opt_c) {
              var text1, diffs;
              if (typeof a == 'string' && typeof opt_b == 'string' &&
                  typeof opt_c == 'undefined') {
                // Method 1: text1, text2
            Severity: Major
            Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 3 hrs to fix

              Function patch_apply has 77 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              diff_match_patch.prototype.patch_apply = function(patches, text) {
                if (patches.length == 0) {
                  return [text, []];
                }
              
              
              Severity: Major
              Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 3 hrs to fix

                Function patch_splitMax has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                diff_match_patch.prototype.patch_splitMax = function(patches) {
                  var patch_size = this.Match_MaxBits;
                  for (var x = 0; x < patches.length; x++) {
                    if (patches[x].length1 <= patch_size) {
                      continue;
                Severity: Major
                Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 3 hrs to fix

                  Function diff_halfMatch_ has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                  Open

                  diff_match_patch.prototype.diff_halfMatch_ = function(text1, text2) {
                    if (this.Diff_Timeout <= 0) {
                      // Don't risk returning a non-optimal diff if we have unlimited time.
                      return null;
                    }
                  Severity: Minor
                  Found in packages/test-in-browser/diff_match_patch_uncompressed.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 match_bitap_ has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  diff_match_patch.prototype.match_bitap_ = function(text, pattern, loc) {
                    if (pattern.length > this.Match_MaxBits) {
                      throw new Error('Pattern too long for this browser.');
                    }
                  
                  
                  Severity: Major
                  Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 2 hrs to fix

                    Function diff_halfMatch_ has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    diff_match_patch.prototype.diff_halfMatch_ = function(text1, text2) {
                      if (this.Diff_Timeout <= 0) {
                        // Don't risk returning a non-optimal diff if we have unlimited time.
                        return null;
                      }
                    Severity: Major
                    Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 2 hrs to fix

                      Function diff_fromDelta has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                      Open

                      diff_match_patch.prototype.diff_fromDelta = function(text1, delta) {
                        var diffs = [];
                        var diffsLength = 0;  // Keeping our own length var is faster in JS.
                        var pointer = 0;  // Cursor in text1
                        var tokens = delta.split(/\t/g);
                      Severity: Minor
                      Found in packages/test-in-browser/diff_match_patch_uncompressed.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 patch_fromText has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      diff_match_patch.prototype.patch_fromText = function(textline) {
                        var patches = [];
                        if (!textline) {
                          return patches;
                        }
                      Severity: Major
                      Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 2 hrs to fix

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

                        diff_match_patch.prototype.diff_linesToChars_ = function(text1, text2) {
                          var lineArray = [];  // e.g. lineArray[4] == 'Hello\n'
                          var lineHash = {};   // e.g. lineHash['Hello\n'] == 4
                        
                          // '\x00' is a valid character, but various debuggers don't like it.
                        Severity: Minor
                        Found in packages/test-in-browser/diff_match_patch_uncompressed.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 diff_cleanupEfficiency has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        diff_match_patch.prototype.diff_cleanupEfficiency = function(diffs) {
                          var changes = false;
                          var equalities = [];  // Stack of indices where equalities are found.
                          var equalitiesLength = 0;  // Keeping our own length var is faster in JS.
                          /** @type {?string} */
                        Severity: Major
                        Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 2 hrs to fix

                          Function diff_lineMode_ has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          diff_match_patch.prototype.diff_lineMode_ = function(text1, text2, deadline) {
                            // Scan the text on a line-by-line basis first.
                            var a = this.diff_linesToChars_(text1, text2);
                            text1 = a.chars1;
                            text2 = a.chars2;
                          Severity: Minor
                          Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 1 hr to fix

                            Function diff_compute_ has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            diff_match_patch.prototype.diff_compute_ = function(text1, text2, checklines,
                                deadline) {
                              var diffs;
                            
                              if (!text1) {
                            Severity: Minor
                            Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 1 hr to fix

                              Function diff_fromDelta has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              diff_match_patch.prototype.diff_fromDelta = function(text1, delta) {
                                var diffs = [];
                                var diffsLength = 0;  // Keeping our own length var is faster in JS.
                                var pointer = 0;  // Cursor in text1
                                var tokens = delta.split(/\t/g);
                              Severity: Minor
                              Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 1 hr to fix

                                Function diff_main has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                diff_match_patch.prototype.diff_main = function(text1, text2, opt_checklines,
                                    opt_deadline) {
                                  // Set a deadline by which time the diff must be complete.
                                  if (typeof opt_deadline == 'undefined') {
                                    if (this.Diff_Timeout <= 0) {
                                Severity: Minor
                                Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 1 hr to fix

                                  Function patch_addPadding has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  diff_match_patch.prototype.patch_addPadding = function(patches) {
                                    var paddingLength = this.Patch_Margin;
                                    var nullPadding = '';
                                    for (var x = 1; x <= paddingLength; x++) {
                                      nullPadding += String.fromCharCode(x);
                                  Severity: Minor
                                  Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 1 hr to fix

                                    Function diff_main has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    diff_match_patch.prototype.diff_main = function(text1, text2, opt_checklines,
                                        opt_deadline) {
                                      // Set a deadline by which time the diff must be complete.
                                      if (typeof opt_deadline == 'undefined') {
                                        if (this.Diff_Timeout <= 0) {
                                    Severity: Minor
                                    Found in packages/test-in-browser/diff_match_patch_uncompressed.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 diff_linesToChars_ has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    diff_match_patch.prototype.diff_linesToChars_ = function(text1, text2) {
                                      var lineArray = [];  // e.g. lineArray[4] == 'Hello\n'
                                      var lineHash = {};   // e.g. lineHash['Hello\n'] == 4
                                    
                                      // '\x00' is a valid character, but various debuggers don't like it.
                                    Severity: Minor
                                    Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 1 hr to fix

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

                                      diff_match_patch.patch_obj.prototype.toString = function() {
                                        var coords1, coords2;
                                        if (this.length1 === 0) {
                                          coords1 = this.start1 + ',0';
                                        } else if (this.length1 == 1) {
                                      Severity: Minor
                                      Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 1 hr to fix

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

                                        diff_match_patch.prototype.diff_compute_ = function(text1, text2, checklines,
                                            deadline) {
                                          var diffs;
                                        
                                          if (!text1) {
                                        Severity: Minor
                                        Found in packages/test-in-browser/diff_match_patch_uncompressed.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 diff_cleanupSemanticScore_ has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                          function diff_cleanupSemanticScore_(one, two) {
                                            if (!one || !two) {
                                              // Edges are the best.
                                              return 6;
                                            }
                                        Severity: Minor
                                        Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 1 hr to fix

                                          Function diff_commonOverlap_ has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                          diff_match_patch.prototype.diff_commonOverlap_ = function(text1, text2) {
                                            // Cache the text lengths to prevent multiple calls.
                                            var text1_length = text1.length;
                                            var text2_length = text2.length;
                                            // Eliminate the null case.
                                          Severity: Minor
                                          Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 1 hr to fix

                                            Function patch_addContext_ has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                            diff_match_patch.prototype.patch_addContext_ = function(patch, text) {
                                              if (text.length == 0) {
                                                return;
                                              }
                                              if (patch.start2 === null) {
                                            Severity: Minor
                                            Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 1 hr to fix

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

                                              diff_match_patch.prototype.diff_lineMode_ = function(text1, text2, deadline) {
                                                // Scan the text on a line-by-line basis first.
                                                var a = this.diff_linesToChars_(text1, text2);
                                                text1 = a.chars1;
                                                text2 = a.chars2;
                                              Severity: Minor
                                              Found in packages/test-in-browser/diff_match_patch_uncompressed.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

                                              Consider simplifying this complex logical expression.
                                              Open

                                                    if (lastEquality && ((pre_ins && pre_del && post_ins && post_del) ||
                                                                         ((lastEquality.length < this.Diff_EditCost / 2) &&
                                                                          (pre_ins + pre_del + post_ins + post_del) == 3))) {
                                                      // Duplicate record.
                                                      diffs.splice(equalities[equalitiesLength - 1], 0,
                                              Severity: Major
                                              Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 1 hr to fix

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

                                                diff_match_patch.patch_obj.prototype.toString = function() {
                                                  var coords1, coords2;
                                                  if (this.length1 === 0) {
                                                    coords1 = this.start1 + ',0';
                                                  } else if (this.length1 == 1) {
                                                Severity: Minor
                                                Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 55 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 diff_commonOverlap_ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                diff_match_patch.prototype.diff_commonOverlap_ = function(text1, text2) {
                                                  // Cache the text lengths to prevent multiple calls.
                                                  var text1_length = text1.length;
                                                  var text2_length = text2.length;
                                                  // Eliminate the null case.
                                                Severity: Minor
                                                Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 55 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 diff_xIndex has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                diff_match_patch.prototype.diff_xIndex = function(diffs, loc) {
                                                  var chars1 = 0;
                                                  var chars2 = 0;
                                                  var last_chars1 = 0;
                                                  var last_chars2 = 0;
                                                Severity: Minor
                                                Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 45 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

                                                Avoid deeply nested control flow statements.
                                                Open

                                                          if (diff_text == bigpatch.diffs[0][1]) {
                                                            bigpatch.diffs.shift();
                                                          } else {
                                                            bigpatch.diffs[0][1] =
                                                                bigpatch.diffs[0][1].substring(diff_text.length);
                                                Severity: Major
                                                Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 45 mins to fix

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                              if (commonlength !== 0) {
                                                                if ((pointer - count_delete - count_insert) > 0 &&
                                                                    diffs[pointer - count_delete - count_insert - 1][0] ==
                                                                    DIFF_EQUAL) {
                                                                  diffs[pointer - count_delete - count_insert - 1][1] +=
                                                  Severity: Major
                                                  Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 45 mins to fix

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                              if (best_loc > loc) {
                                                                // When passing loc, don't exceed our current distance from loc.
                                                                start = Math.max(1, 2 * loc - best_loc);
                                                              } else {
                                                                // Already passed loc, downhill from here on in.
                                                    Severity: Major
                                                    Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 45 mins to fix

                                                      Avoid deeply nested control flow statements.
                                                      Open

                                                                if (x1 >= x2) {
                                                                  // Overlap detected.
                                                                  return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);
                                                                }
                                                      Severity: Major
                                                      Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 45 mins to fix

                                                        Avoid deeply nested control flow statements.
                                                        Open

                                                                  if (x1 >= x2) {
                                                                    // Overlap detected.
                                                                    return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);
                                                                  }
                                                        Severity: Major
                                                        Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 45 mins to fix

                                                          Avoid deeply nested control flow statements.
                                                          Open

                                                                    if (diff_type === DIFF_EQUAL) {
                                                                      patch.length2 += diff_text.length;
                                                                      start2 += diff_text.length;
                                                                    } else {
                                                                      empty = false;
                                                          Severity: Major
                                                          Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 45 mins to fix

                                                            Avoid deeply nested control flow statements.
                                                            Open

                                                                        if (commonlength !== 0) {
                                                                          diffs[pointer][1] = text_insert.substring(text_insert.length -
                                                                              commonlength) + diffs[pointer][1];
                                                                          text_insert = text_insert.substring(0, text_insert.length -
                                                                              commonlength);
                                                            Severity: Major
                                                            Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 45 mins to fix

                                                              Avoid deeply nested control flow statements.
                                                              Open

                                                                        for (var y = 0; y < patches[x].diffs.length; y++) {
                                                                          var mod = patches[x].diffs[y];
                                                                          if (mod[0] !== DIFF_EQUAL) {
                                                                            index2 = this.diff_xIndex(diffs, index1);
                                                                          }
                                                              Severity: Major
                                                              Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 45 mins to fix

                                                                Function diff_bisectSplit_ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                Open

                                                                diff_match_patch.prototype.diff_bisectSplit_ = function(text1, text2, x, y,
                                                                    deadline) {
                                                                Severity: Minor
                                                                Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 35 mins to fix

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

                                                                  diff_match_patch.prototype.patch_addPadding = function(patches) {
                                                                    var paddingLength = this.Patch_Margin;
                                                                    var nullPadding = '';
                                                                    for (var x = 1; x <= paddingLength; x++) {
                                                                      nullPadding += String.fromCharCode(x);
                                                                  Severity: Minor
                                                                  Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 35 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

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                    return this.diff_bisect_(text1, text2, deadline);
                                                                  Severity: Major
                                                                  Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                        return diffs_a.concat([new diff_match_patch.Diff(DIFF_EQUAL, mid_common)],
                                                                                              diffs_b);
                                                                    Severity: Major
                                                                    Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 30 mins to fix

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                            return 2;
                                                                      Severity: Major
                                                                      Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                            return this.diff_lineMode_(text1, text2, deadline);
                                                                        Severity: Major
                                                                        Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                                return 1;
                                                                          Severity: Major
                                                                          Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                                return 0;
                                                                            Severity: Major
                                                                            Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 30 mins to fix

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

                                                                              diff_match_patch.prototype.diff_commonPrefix = function(text1, text2) {
                                                                                // Quick check for common null cases.
                                                                                if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {
                                                                                  return 0;
                                                                                }
                                                                              Severity: Minor
                                                                              Found in packages/test-in-browser/diff_match_patch_uncompressed.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

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

                                                                              diff_match_patch.prototype.patch_addContext_ = function(patch, text) {
                                                                                if (text.length == 0) {
                                                                                  return;
                                                                                }
                                                                                if (patch.start2 === null) {
                                                                              Severity: Minor
                                                                              Found in packages/test-in-browser/diff_match_patch_uncompressed.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

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

                                                                              diff_match_patch.prototype.diff_text1 = function(diffs) {
                                                                                var text = [];
                                                                                for (var x = 0; x < diffs.length; x++) {
                                                                                  if (diffs[x][0] !== DIFF_INSERT) {
                                                                                    text[x] = diffs[x][1];
                                                                              Severity: Major
                                                                              Found in packages/test-in-browser/diff_match_patch_uncompressed.js and 1 other location - About 3 hrs to fix
                                                                              packages/test-in-browser/diff_match_patch_uncompressed.js on lines 1289..1297

                                                                              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 109.

                                                                              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

                                                                              diff_match_patch.prototype.diff_text2 = function(diffs) {
                                                                                var text = [];
                                                                                for (var x = 0; x < diffs.length; x++) {
                                                                                  if (diffs[x][0] !== DIFF_DELETE) {
                                                                                    text[x] = diffs[x][1];
                                                                              Severity: Major
                                                                              Found in packages/test-in-browser/diff_match_patch_uncompressed.js and 1 other location - About 3 hrs to fix
                                                                              packages/test-in-browser/diff_match_patch_uncompressed.js on lines 1273..1281

                                                                              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 109.

                                                                              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

                                                                                  if (m[2] === '') {
                                                                                    patch.start1--;
                                                                                    patch.length1 = 1;
                                                                                  } else if (m[2] == '0') {
                                                                                    patch.length1 = 0;
                                                                              Severity: Major
                                                                              Found in packages/test-in-browser/diff_match_patch_uncompressed.js and 1 other location - About 3 hrs to fix
                                                                              packages/test-in-browser/diff_match_patch_uncompressed.js on lines 2108..2116

                                                                              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 95.

                                                                              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

                                                                                  if (m[4] === '') {
                                                                                    patch.start2--;
                                                                                    patch.length2 = 1;
                                                                                  } else if (m[4] == '0') {
                                                                                    patch.length2 = 0;
                                                                              Severity: Major
                                                                              Found in packages/test-in-browser/diff_match_patch_uncompressed.js and 1 other location - About 3 hrs to fix
                                                                              packages/test-in-browser/diff_match_patch_uncompressed.js on lines 2097..2105

                                                                              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 95.

                                                                              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

                                                                                if (this.length1 === 0) {
                                                                                  coords1 = this.start1 + ',0';
                                                                                } else if (this.length1 == 1) {
                                                                                  coords1 = this.start1 + 1;
                                                                                } else {
                                                                              Severity: Major
                                                                              Found in packages/test-in-browser/diff_match_patch_uncompressed.js and 1 other location - About 2 hrs to fix
                                                                              packages/test-in-browser/diff_match_patch_uncompressed.js on lines 2185..2191

                                                                              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 92.

                                                                              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

                                                                                if (this.length2 === 0) {
                                                                                  coords2 = this.start2 + ',0';
                                                                                } else if (this.length2 == 1) {
                                                                                  coords2 = this.start2 + 1;
                                                                                } else {
                                                                              Severity: Major
                                                                              Found in packages/test-in-browser/diff_match_patch_uncompressed.js and 1 other location - About 2 hrs to fix
                                                                              packages/test-in-browser/diff_match_patch_uncompressed.js on lines 2178..2184

                                                                              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 92.

                                                                              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

                                                                                    if (k2 == -d || (k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1])) {
                                                                                      x2 = v2[k2_offset + 1];
                                                                                    } else {
                                                                                      x2 = v2[k2_offset - 1] + 1;
                                                                                    }
                                                                              Severity: Major
                                                                              Found in packages/test-in-browser/diff_match_patch_uncompressed.js and 1 other location - About 2 hrs to fix
                                                                              packages/test-in-browser/diff_match_patch_uncompressed.js on lines 343..347

                                                                              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 83.

                                                                              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

                                                                                    if (k1 == -d || (k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1])) {
                                                                                      x1 = v1[k1_offset + 1];
                                                                                    } else {
                                                                                      x1 = v1[k1_offset - 1] + 1;
                                                                                    }
                                                                              Severity: Major
                                                                              Found in packages/test-in-browser/diff_match_patch_uncompressed.js and 1 other location - About 2 hrs to fix
                                                                              packages/test-in-browser/diff_match_patch_uncompressed.js on lines 378..382

                                                                              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 83.

                                                                              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

                                                                                if (text1.length > text2.length) {
                                                                                  text1_a = hm[0];
                                                                                  text1_b = hm[1];
                                                                                  text2_a = hm[2];
                                                                                  text2_b = hm[3];
                                                                              Severity: Minor
                                                                              Found in packages/test-in-browser/diff_match_patch_uncompressed.js and 1 other location - About 35 mins to fix
                                                                              packages/test-in-browser/diff_match_patch_uncompressed.js on lines 735..740

                                                                              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 47.

                                                                              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

                                                                                } else {
                                                                                  text2_a = hm[0];
                                                                                  text2_b = hm[1];
                                                                                  text1_a = hm[2];
                                                                                  text1_b = hm[3];
                                                                              Severity: Minor
                                                                              Found in packages/test-in-browser/diff_match_patch_uncompressed.js and 1 other location - About 35 mins to fix
                                                                              packages/test-in-browser/diff_match_patch_uncompressed.js on lines 730..735

                                                                              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 47.

                                                                              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

                                                                              There are no issues that match your filters.

                                                                              Category
                                                                              Status