zxing-js/library

View on GitHub

Showing 958 of 958 total issues

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

        for (const ecBlock of ecBlockArray) {
            for (let i = 0; i < ecBlock.getCount(); i++) {
                const numDataCodewords = ecBlock.getDataCodewords();
                const numBlockCodewords = ecBlocks.getECCodewordsPerBlock() + numDataCodewords;
                result[numResultBlocks++] = new DataBlock(numDataCodewords, new Uint8Array(numBlockCodewords));
Severity: Major
Found in src/core/qrcode/decoder/DataBlock.ts and 1 other location - About 2 hrs to fix
src/core/datamatrix/decoder/DataBlock.ts on lines 63..69

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

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

    for (let ecBlock of ecBlockArray) {
      for (let i = 0; i < ecBlock.getCount(); i++) {
        const numDataCodewords = ecBlock.getDataCodewords();
        const numBlockCodewords = ecBlocks.getECCodewords() + numDataCodewords;
        result[numResultBlocks++] = new DataBlock(numDataCodewords, new Uint8Array(numBlockCodewords));
Severity: Major
Found in src/core/datamatrix/decoder/DataBlock.ts and 1 other location - About 2 hrs to fix
src/core/qrcode/decoder/DataBlock.ts on lines 70..76

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

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 byteCompaction has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private static /*int*/ byteCompaction(mode: int,
    codewords: Int32Array,
    encoding: /*Charset*/ CharacterSetECI,
    codeIndex: int,
    result: StringBuilder) {
Severity: Major
Found in src/core/pdf417/decoder/DecodedBitStreamParser.ts - About 2 hrs to fix

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

            new Version(17, Int32Array.from([6, 30, 54, 78]),
                new ECBlocks(28, new ECB(1, 107),
                    new ECB(5, 108)),
                new ECBlocks(28, new ECB(10, 46),
                    new ECB(1, 47)),
    Severity: Major
    Found in src/core/qrcode/decoder/Version.ts and 6 other locations - About 2 hrs to fix
    src/core/qrcode/decoder/Version.ts on lines 141..149
    src/core/qrcode/decoder/Version.ts on lines 150..158
    src/core/qrcode/decoder/Version.ts on lines 159..167
    src/core/qrcode/decoder/Version.ts on lines 177..185
    src/core/qrcode/decoder/Version.ts on lines 186..194
    src/core/qrcode/decoder/Version.ts on lines 195..203

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

    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 7 locations. Consider refactoring.
    Open

            new Version(18, Int32Array.from([6, 30, 56, 82]),
                new ECBlocks(30, new ECB(5, 120),
                    new ECB(1, 121)),
                new ECBlocks(26, new ECB(9, 43),
                    new ECB(4, 44)),
    Severity: Major
    Found in src/core/qrcode/decoder/Version.ts and 6 other locations - About 2 hrs to fix
    src/core/qrcode/decoder/Version.ts on lines 141..149
    src/core/qrcode/decoder/Version.ts on lines 150..158
    src/core/qrcode/decoder/Version.ts on lines 159..167
    src/core/qrcode/decoder/Version.ts on lines 168..176
    src/core/qrcode/decoder/Version.ts on lines 186..194
    src/core/qrcode/decoder/Version.ts on lines 195..203

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

    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 7 locations. Consider refactoring.
    Open

            new Version(20, Int32Array.from([6, 34, 62, 90]),
                new ECBlocks(28, new ECB(3, 107),
                    new ECB(5, 108)),
                new ECBlocks(26, new ECB(3, 41),
                    new ECB(13, 42)),
    Severity: Major
    Found in src/core/qrcode/decoder/Version.ts and 6 other locations - About 2 hrs to fix
    src/core/qrcode/decoder/Version.ts on lines 141..149
    src/core/qrcode/decoder/Version.ts on lines 150..158
    src/core/qrcode/decoder/Version.ts on lines 159..167
    src/core/qrcode/decoder/Version.ts on lines 168..176
    src/core/qrcode/decoder/Version.ts on lines 177..185
    src/core/qrcode/decoder/Version.ts on lines 186..194

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

    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 7 locations. Consider refactoring.
    Open

            new Version(15, Int32Array.from([6, 26, 48, 70]),
                new ECBlocks(22, new ECB(5, 87),
                    new ECB(1, 88)),
                new ECBlocks(24, new ECB(5, 41),
                    new ECB(5, 42)),
    Severity: Major
    Found in src/core/qrcode/decoder/Version.ts and 6 other locations - About 2 hrs to fix
    src/core/qrcode/decoder/Version.ts on lines 141..149
    src/core/qrcode/decoder/Version.ts on lines 159..167
    src/core/qrcode/decoder/Version.ts on lines 168..176
    src/core/qrcode/decoder/Version.ts on lines 177..185
    src/core/qrcode/decoder/Version.ts on lines 186..194
    src/core/qrcode/decoder/Version.ts on lines 195..203

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

    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 7 locations. Consider refactoring.
    Open

            new Version(16, Int32Array.from([6, 26, 50, 74]),
                new ECBlocks(24, new ECB(5, 98),
                    new ECB(1, 99)),
                new ECBlocks(28, new ECB(7, 45),
                    new ECB(3, 46)),
    Severity: Major
    Found in src/core/qrcode/decoder/Version.ts and 6 other locations - About 2 hrs to fix
    src/core/qrcode/decoder/Version.ts on lines 141..149
    src/core/qrcode/decoder/Version.ts on lines 150..158
    src/core/qrcode/decoder/Version.ts on lines 168..176
    src/core/qrcode/decoder/Version.ts on lines 177..185
    src/core/qrcode/decoder/Version.ts on lines 186..194
    src/core/qrcode/decoder/Version.ts on lines 195..203

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

    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 7 locations. Consider refactoring.
    Open

            new Version(19, Int32Array.from([6, 30, 58, 86]),
                new ECBlocks(28, new ECB(3, 113),
                    new ECB(4, 114)),
                new ECBlocks(26, new ECB(3, 44),
                    new ECB(11, 45)),
    Severity: Major
    Found in src/core/qrcode/decoder/Version.ts and 6 other locations - About 2 hrs to fix
    src/core/qrcode/decoder/Version.ts on lines 141..149
    src/core/qrcode/decoder/Version.ts on lines 150..158
    src/core/qrcode/decoder/Version.ts on lines 159..167
    src/core/qrcode/decoder/Version.ts on lines 168..176
    src/core/qrcode/decoder/Version.ts on lines 177..185
    src/core/qrcode/decoder/Version.ts on lines 195..203

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

    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 7 locations. Consider refactoring.
    Open

            new Version(14, Int32Array.from([6, 26, 46, 66]),
                new ECBlocks(30, new ECB(3, 115),
                    new ECB(1, 116)),
                new ECBlocks(24, new ECB(4, 40),
                    new ECB(5, 41)),
    Severity: Major
    Found in src/core/qrcode/decoder/Version.ts and 6 other locations - About 2 hrs to fix
    src/core/qrcode/decoder/Version.ts on lines 150..158
    src/core/qrcode/decoder/Version.ts on lines 159..167
    src/core/qrcode/decoder/Version.ts on lines 168..176
    src/core/qrcode/decoder/Version.ts on lines 177..185
    src/core/qrcode/decoder/Version.ts on lines 186..194
    src/core/qrcode/decoder/Version.ts on lines 195..203

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

    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 addEdges has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      static addEdges(
        input: Input,
        edges: Edge[][],
        from: number,
        previous: Edge
    Severity: Minor
    Found in src/core/datamatrix/encoder/MinimalEncoder.ts - 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 handlePossibleCenter has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        protected handlePossibleCenter(stateCount: Int32Array, i: number /*int*/, j: number /*int*/, pureBarcode: boolean): boolean {
            const stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] +
                stateCount[4];
            let centerJ: number /*float*/ = FinderPatternFinder.centerFromEnd(stateCount, j);
            let centerI: number /*float*/ = this.crossCheckVertical(i, /*(int) */Math.floor(centerJ), stateCount[2], stateCountTotal);
    Severity: Minor
    Found in src/core/qrcode/detector/FinderPatternFinder.ts - 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 encodeLowLevel has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      private encodeLowLevel(
        placement: DefaultPlacement,
        symbolInfo: SymbolInfo,
        width: number,
        height: number
    Severity: Minor
    Found in src/core/datamatrix/DataMatrixWriter.ts - 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 sizeOfBlackWhiteBlackRun has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      private sizeOfBlackWhiteBlackRun(fromX: number /*int*/, fromY: number /*int*/, toX: number /*int*/, toY: number /*int*/): number/*float*/ {
        // Mild variant of Bresenham's algorithm
        // see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm
        const steep: boolean = Math.abs(toY - fromY) > Math.abs(toX - fromX);
        if (steep) {
    Severity: Minor
    Found in src/core/qrcode/detector/Detector.ts - 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 buildBitArray has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      static buildBitArray(pairs: Array<ExpandedPair>): BitArray {
        let charNumber: number = pairs.length * 2 - 1;
        if (pairs[pairs.length - 1].getRightChar() == null) {
          charNumber -= 1;
        }
    Severity: Minor
    Found in src/core/oned/rss/expanded/BitArrayBuilder.ts - 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

            new Version(12, Int32Array.from([6, 32, 58]),
                new ECBlocks(24, new ECB(2, 92),
                    new ECB(2, 93)),
                new ECBlocks(22, new ECB(6, 36),
                    new ECB(2, 37)),
    Severity: Major
    Found in src/core/qrcode/decoder/Version.ts and 1 other location - About 2 hrs to fix
    src/core/qrcode/decoder/Version.ts on lines 107..115

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

    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

        let candidate1 = new ResultPoint(
          pointD.getX() + (pointC.getX() - pointB.getX()) / (trTop + 1),
          pointD.getY() + (pointC.getY() - pointB.getY()) / (trTop + 1));
    Severity: Major
    Found in src/core/datamatrix/detector/Detector.ts and 1 other location - About 2 hrs to fix
    src/core/datamatrix/detector/Detector.ts on lines 225..227

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

    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

            new Version(10, Int32Array.from([6, 28, 50]),
                new ECBlocks(18, new ECB(2, 68),
                    new ECB(2, 69)),
                new ECBlocks(26, new ECB(4, 43),
                    new ECB(1, 44)),
    Severity: Major
    Found in src/core/qrcode/decoder/Version.ts and 1 other location - About 2 hrs to fix
    src/core/qrcode/decoder/Version.ts on lines 124..132

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

    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

          let candidate2 = new ResultPoint(
          pointD.getX() + (pointA.getX() - pointB.getX()) / (trRight + 1),
          pointD.getY() + (pointA.getY() - pointB.getY()) / (trRight + 1));
    Severity: Major
    Found in src/core/datamatrix/detector/Detector.ts and 1 other location - About 2 hrs to fix
    src/core/datamatrix/detector/Detector.ts on lines 222..224

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

    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 constructor has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      constructor(solution: Edge) {
        const input = solution.input;
        let size = 0;
        let bytesAL: number[] = [];
        const randomizePostfixLength = [];
    Severity: Major
    Found in src/core/datamatrix/encoder/MinimalEncoder.ts - About 2 hrs to fix
      Severity
      Category
      Status
      Source
      Language