edit-distance/myers-1986

View on GitHub

Showing 43 of 43 total issues

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

        V[c] = Math.max(V[(c + 1) | 0], (V[(c - 1) | 0] + 1) | 0);
Severity: Minor
Found in src/forwardStep.js and 1 other location - About 50 mins to fix
src/backwardStep.js on lines 20..20

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

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[c] = Math.min(V[(c - 1) | 0], (V[(c + 1) | 0] - 1) | 0);
Severity: Minor
Found in src/backwardStep.js and 1 other location - About 50 mins to fix
src/forwardStep.js on lines 36..36

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

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 twoWayRealloc has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

export default function twoWayRealloc(B, MAX, li, lj, ri, rj) {
Severity: Minor
Found in src/twoWayRealloc.js - About 45 mins to fix

    Function diff has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    export default function diff(MAX, eq, li, lj, ri, rj) {
    Severity: Minor
    Found in src/diff.js - About 45 mins to fix

      Function recurse has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      export default function recurse(MAX, eq, li, lj, ri, rj) {
      Severity: Minor
      Found in src/recurse.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if (V[c] === V[(c + cBDcF) | 0]) {
                                // XEnd === V[centerB + k - Delta]
                                return new Split(
                                    (c - cFmD0) | 0, // K + Delta0
                                    longestCommonSuffix(eq, x, li, (x - ((c - cFmD0) | 0)) | 0, ri),
        Severity: Major
        Found in src/twoWayScan.js - About 45 mins to fix

          Function longestCommonSuffix has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function longestCommonSuffix(eq, aj, ai, bj, bi) {
              assert(Number.isInteger(aj));
              assert(Number.isInteger(ai) && ai >= 0);
              assert(Number.isInteger(bj));
              assert(Number.isInteger(bi) && bi >= 0);
          Severity: Minor
          Found in src/longestCommonSuffix.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

          Function oneWay has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          export default function oneWay(MAX, eq, li, lj, ri, rj) {
          Severity: Minor
          Found in src/oneWay.js - About 45 mins to fix

            Function oneWay has a Cognitive Complexity of 8 (exceeds 5 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 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

            Function longestCommonPrefix has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            export default function longestCommonPrefix(eq, ai, aj, bi, bj) {
                assert(Number.isInteger(ai) && ai >= 0);
                assert(Number.isInteger(aj));
                assert(Number.isInteger(bi) && bi >= 0);
                assert(Number.isInteger(bj));
            Severity: Minor
            Found in src/longestCommonPrefix.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

            Function oneWayAlloc has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            export default function oneWayAlloc(MAX, li, lj, ri, rj, init) {
            Severity: Minor
            Found in src/oneWayAlloc.js - About 45 mins to fix

              Function twoWay has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              export default function twoWay(MAX, eq, li, lj, ri, rj) {
              Severity: Minor
              Found in src/twoWay.js - About 45 mins to fix

                Function recurseDeep has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                export default function recurseDeep(MAX, eq, li, lj, ri, rj) {
                Severity: Minor
                Found in src/recurseDeep.js - About 45 mins to fix

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

                  export default function StackEntry(D, li, lj, ri, rj) {
                  Severity: Minor
                  Found in src/StackEntry.js - About 35 mins to fix

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

                    export default function longestCommonPrefix(eq, ai, aj, bi, bj) {
                    Severity: Minor
                    Found in src/longestCommonPrefix.js - About 35 mins to fix

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

                      export default function twoWayAlloc(MAX, li, lj, ri, rj) {
                      Severity: Minor
                      Found in src/twoWayAlloc.js - About 35 mins to fix

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

                        export default function Split(k, xBegin, xEnd, distanceLeft, distance) {
                        Severity: Minor
                        Found in src/Split.js - About 35 mins to fix

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

                          export default function longestCommonSuffix(eq, aj, ai, bj, bi) {
                          Severity: Minor
                          Found in src/longestCommonSuffix.js - About 35 mins to fix

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

                                const maxDistance =
                                    (((lj - li) | 0) + ((((rj - ri) | 0) - ((xEnd - xBegin) << 1)) | 0)) | 0;
                            Severity: Minor
                            Found in src/recurse.js and 1 other location - About 35 mins to fix
                            src/recurseDeep.js on lines 47..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 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

                                const maxDistance =
                                    (((lj - li) | 0) + ((((rj - ri) | 0) - ((xEnd - xBegin) << 1)) | 0)) | 0;
                            Severity: Minor
                            Found in src/recurseDeep.js and 1 other location - About 35 mins to fix
                            src/recurse.js on lines 50..51

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language