edit-distance/myers-1986

View on GitHub

Showing 43 of 43 total issues

Function twoWayScan has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

export default function twoWayScan(
    MAX,
    V,
    centerF,
    centerB,
Severity: Minor
Found in src/twoWayScan.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 twoWayScan has 126 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function twoWayScan(
    MAX,
    V,
    centerF,
    centerB,
Severity: Major
Found in src/twoWayScan.js - About 5 hrs to fix

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

    const diff = (x, y) => {
        const eq = (xi, yi) => x[xi] === y[yi];
        const xi = 0;
        const xj = x.length;
        const yi = 0;
    Severity: Major
    Found in _profile/diff.js and 1 other location - About 3 hrs to fix
    _profile/analyze.js on lines 17..25

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

    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

    const diff = (x, y) => {
        const eq = (xi, yi) => x[xi] === y[yi];
        const xi = 0;
        const xj = x.length;
        const yi = 0;
    Severity: Major
    Found in _profile/analyze.js and 1 other location - About 3 hrs to fix
    _profile/diff.js on lines 11..19

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

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

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

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

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

    Refactorings

    Further Reading

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

    export default function makeScan32(method) {
        /**
         * Returns distance, or -1 if distance > MAX.
         * Undefined behavior if indices are not int32.
         *
    Severity: Minor
    Found in src/makeScan32.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

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

        V[cMin] =
            cMin === cmD
                ? (V[(cMin + 1) | 0] - 1) | 0
                : Math.min(V[(cMin - 1) | 0], (V[(cMin + 1) | 0] - 1) | 0);
    Severity: Major
    Found in src/backwardStep.js and 1 other location - About 2 hrs to fix
    src/forwardStep.js on lines 45..48

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 81.

    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

        V[cMax] =
            cMax === cpD
                ? (V[(cMax - 1) | 0] + 1) | 0
                : Math.max(V[(cMax + 1) | 0], (V[(cMax - 1) | 0] + 1) | 0);
    Severity: Major
    Found in src/forwardStep.js and 1 other location - About 2 hrs to fix
    src/backwardStep.js on lines 14..17

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

    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

    export default function Split(k, xBegin, xEnd, distanceLeft, distance) {
        this.k = k;
        this.xBegin = xBegin;
        this.xEnd = xEnd;
        this.distanceLeft = distanceLeft;
    Severity: Major
    Found in src/Split.js and 1 other location - About 1 hr to fix
    src/StackEntry.js on lines 10..16

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

    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

    export default function StackEntry(D, li, lj, ri, rj) {
        this.D = D;
        this.li = li;
        this.lj = lj;
        this.ri = ri;
    Severity: Major
    Found in src/StackEntry.js and 1 other location - About 1 hr to fix
    src/Split.js on lines 10..16

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

    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 {
            while (bi < bj && eq((aj - 1) | 0, (bj - 1) | 0)) {
                aj = (aj - 1) | 0;
                bj = (bj - 1) | 0;
            }
    Severity: Major
    Found in src/longestCommonSuffix.js and 1 other location - About 1 hr to fix
    src/longestCommonSuffix.js on lines 18..23

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

    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 (((aj - ai) | 0) <= ((bj - bi) | 0)) {
            while (ai < aj && eq((aj - 1) | 0, (bj - 1) | 0)) {
                aj = (aj - 1) | 0;
                bj = (bj - 1) | 0;
            }
    Severity: Major
    Found in src/longestCommonSuffix.js and 1 other location - About 1 hr to fix
    src/longestCommonSuffix.js on lines 23..28

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

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

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

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

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

    Refactorings

    Further Reading

    Function recurseDeep has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function recurseDeep(MAX, eq, li, lj, ri, rj) {
        assert(MAX >= 1);
        assert(lj - li + rj - ri >= MAX);
        if (li === lj || ri === rj) {
            assert(li < lj || ri < rj);
    Severity: Minor
    Found in src/recurseDeep.js - About 1 hr to fix

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

      export default function recurseDeeperStep(B, stack, eq) {
          assert(stack.length > 0);
          const entry = stack.pop();
          assert(entry instanceof StackEntry);
          let MAX = entry.D;
      Severity: Minor
      Found in src/recurseDeeperStep.js - About 1 hr to fix

        Function recurse has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function recurse(MAX, eq, li, lj, ri, rj) {
            assert(MAX >= 0);
            assert(lj - li + rj - ri > MAX);
            if (li === lj || ri === rj) {
                assert(lj - li > MAX || rj - ri > MAX);
        Severity: Minor
        Found in src/recurse.js - About 1 hr to fix

          Function oneWay has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function oneWay(MAX, eq, li, lj, ri, rj) {
              assert(MAX > 0);
              assert(MAX <= lj - li + rj - ri);
              assert(li < lj);
              assert(ri < rj);
          Severity: Minor
          Found in src/oneWay.js - About 1 hr to fix

            Function twoWayScan has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                MAX,
                V,
                centerF,
                centerB,
                eq,
            Severity: Major
            Found in src/twoWayScan.js - About 1 hr to fix

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

                  } else {
                      while (bi < bj && eq(ai, bi)) {
                          ai = (ai + 1) | 0;
                          bi = (bi + 1) | 0;
                      }
              Severity: Minor
              Found in src/longestCommonPrefix.js and 1 other location - About 55 mins to fix
              src/longestCommonPrefix.js on lines 18..23

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

              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 (((aj - ai) | 0) <= ((bj - bi) | 0)) {
                      while (ai < aj && eq(ai, bi)) {
                          ai = (ai + 1) | 0;
                          bi = (bi + 1) | 0;
                      }
              Severity: Minor
              Found in src/longestCommonPrefix.js and 1 other location - About 55 mins to fix
              src/longestCommonPrefix.js on lines 23..28

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

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

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

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

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

              Refactorings

              Further Reading

              Function backwardExtend has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  cMin,
                  cMax,
                  cx,
                  V,
                  eq,
              Severity: Major
              Found in src/backwardExtend.js - About 50 mins to fix

                Function forwardExtend has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                export default function forwardExtend(cMin, cMax, cx, V, eq, lj, rj) {
                Severity: Major
                Found in src/forwardExtend.js - About 50 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language