jmuheim/base

View on GitHub
app/assets/javascripts/diff_match_patch.js

Summary

Maintainability
F
4 days
Test Coverage

File diff_match_patch.js has 641 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function() {
    function diff_match_patch() {
        this.Diff_Timeout = 1;
        this.Diff_EditCost = 4;
        this.Match_Threshold = 0.5;
Severity: Major
Found in app/assets/javascripts/diff_match_patch.js - About 1 day to fix

    Consider simplifying this complex logical expression.
    Open

                if (!(a[c].length1 <= b)) {
                    var d = a[c];
                    a.splice(c--, 1);
                    for (var e = d.start1, f = d.start2, g = ""; 0 !== d.diffs.length;) {
                        var h = new diff_match_patch.patch_obj,
    Severity: Critical
    Found in app/assets/javascripts/diff_match_patch.js - About 1 hr to fix

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

          diff_match_patch.prototype.diff_cleanupSemanticLossless = function(a) {
              function b(a, b) {
                  if (!a || !b) return 6;
                  var c = a.charAt(a.length - 1),
                      d = b.charAt(0),
      Severity: Minor
      Found in app/assets/javascripts/diff_match_patch.js - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                    else if (-1 == a[f][0] ? i = !0 : j = !0, e && (g && h && j && i || e.length < this.Diff_EditCost / 2 && 3 == g + h + j + i)) a.splice(c[d - 1], 0, [-1, e]), a[c[d - 1] + 1][0] = 1, d--, e = null, g && h ? (j = i = !0, d = 0) : (d--, f = 0 < d ? c[d - 1] : -1, j = i = !1), b = !0;
        Severity: Critical
        Found in app/assets/javascripts/diff_match_patch.js - About 1 hr to fix

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

              diff_match_patch.prototype.diff_lineMode_ = function(a, b, c) {
                  var d = this.diff_linesToChars_(a, b);
                  a = d.chars1;
                  b = d.chars2;
                  d = d.lineArray;
          Severity: Minor
          Found in app/assets/javascripts/diff_match_patch.js - About 1 hr to fix

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

                diff_match_patch.prototype.diff_bisect_ = function(a, b, c) {
                    for (var d = a.length, e = b.length, f = Math.ceil((d + e) / 2), g = f, h = 2 * f, j = Array(h), i = Array(h), k = 0; k < h; k++) j[k] = -1, i[k] = -1;
                    j[g + 1] = 0;
                    i[g + 1] = 0;
                    for (var k = d - e, q = 0 != k % 2, r = 0, t = 0, p = 0, w = 0, v = 0; v < f && !((new Date).getTime() > c); v++) {
            Severity: Minor
            Found in app/assets/javascripts/diff_match_patch.js - About 1 hr to fix

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

                  diff_match_patch.prototype.patch_make = function(a, b, c) {
                      var d;
                      if ("string" == typeof a && "string" == typeof b && "undefined" == typeof c) d = a, b = this.diff_main(d, b, !0), 2 < b.length && (this.diff_cleanupSemantic(b), this.diff_cleanupEfficiency(b));
                      else if (a && "object" == typeof a && "undefined" == typeof b && "undefined" == typeof c) b = a, d = this.diff_text1(b);
                      else if ("string" == typeof a && b && "object" == typeof b && "undefined" == typeof c) d = a;
              Severity: Minor
              Found in app/assets/javascripts/diff_match_patch.js - About 1 hr to fix

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

                    diff_match_patch.prototype.patch_fromText = function(a) {
                        var b = [];
                        if (!a) return b;
                        a = a.split("\n");
                        for (var c = 0, d = /^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/; c < a.length;) {
                Severity: Minor
                Found in app/assets/javascripts/diff_match_patch.js - About 1 hr to fix

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

                      diff_match_patch.prototype.match_bitap_ = function(a, b, c) {
                          function d(a, d) {
                              var e = a / b.length,
                                  g = Math.abs(c - d);
                              return !f.Match_Distance ? g ? 1 : e : e + g / f.Match_Distance
                  Severity: Minor
                  Found in app/assets/javascripts/diff_match_patch.js - About 1 hr to fix

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

                        diff_match_patch.prototype.patch_apply = function(a, b) {
                            if (0 == a.length) return [b, []];
                            a = this.patch_deepCopy(a);
                            var c = this.patch_addPadding(a);
                            b = c + b + c;
                    Severity: Minor
                    Found in app/assets/javascripts/diff_match_patch.js - About 1 hr to fix

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

                          diff_match_patch.prototype.diff_bisectSplit_ = function(a, b, c, d, e) {
                      Severity: Minor
                      Found in app/assets/javascripts/diff_match_patch.js - About 35 mins to fix

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

                                    "" === e[2] ? (f.start1--, f.length1 = 1) : "0" == e[2] ? f.length1 = 0 : (f.start1--, f.length1 = parseInt(e[2], 10));
                        Severity: Major
                        Found in app/assets/javascripts/diff_match_patch.js and 1 other location - About 2 hrs to fix
                        app/assets/javascripts/diff_match_patch.js on lines 592..593

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

                        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

                                    "" === e[4] ? (f.start2--, f.length2 = 1) : "0" == e[4] ? f.length2 = 0 : (f.start2--, f.length2 =
                                        parseInt(e[4], 10));
                        Severity: Major
                        Found in app/assets/javascripts/diff_match_patch.js and 1 other location - About 2 hrs to fix
                        app/assets/javascripts/diff_match_patch.js on lines 590..590

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

                        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

                                        u = n == -v || n != v && i[l - 1] < i[l + 1] ? i[l + 1] : i[l - 1] + 1;
                        Severity: Major
                        Found in app/assets/javascripts/diff_match_patch.js and 1 other location - About 1 hr to fix
                        app/assets/javascripts/diff_match_patch.js on lines 99..99

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

                        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

                                b = 0 === this.length2 ? this.start2 + ",0" : 1 == this.length2 ? this.start2 + 1 : this.start2 + 1 + "," + this.length2;
                        Severity: Major
                        Found in app/assets/javascripts/diff_match_patch.js and 1 other location - About 1 hr to fix
                        app/assets/javascripts/diff_match_patch.js on lines 618..618

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

                        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

                                        m = n == -v || n != v && j[l - 1] < j[l + 1] ? j[l + 1] : j[l - 1] + 1;
                        Severity: Major
                        Found in app/assets/javascripts/diff_match_patch.js and 1 other location - About 1 hr to fix
                        app/assets/javascripts/diff_match_patch.js on lines 112..112

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

                        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

                                a = 0 === this.length1 ? this.start1 + ",0" : 1 == this.length1 ? this.start1 + 1 : this.start1 + 1 + "," + this.length1;
                        Severity: Major
                        Found in app/assets/javascripts/diff_match_patch.js and 1 other location - About 1 hr to fix
                        app/assets/javascripts/diff_match_patch.js on lines 619..619

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

                        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