zxing-js/library

View on GitHub

Showing 958 of 958 total issues

Avoid deeply nested control flow statements.
Open

                        while ((theBits >>> bit) === 0) {
                            bit--;
                        }
Severity: Major
Found in src/core/common/BitMatrix.ts - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if ((x32 * 32 + bit) > right) {
                                right = x32 * 32 + bit;
                            }
    Severity: Major
    Found in src/core/common/BitMatrix.ts - About 45 mins to fix

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

          public getBlackMatrix(): BitMatrix /*throws NotFoundException*/ {
              if (this.matrix !== null) {
                  return this.matrix;
              }
              const source = this.getLuminanceSource();
      Severity: Minor
      Found in src/core/common/HybridBinarizer.ts - 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 setRange has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        public setRange(start: number /*int*/, end: number /*int*/): void {
          if (end < start || start < 0 || end > this.size) {
            throw new IllegalArgumentException();
          }
          if (end === start) {
      Severity: Minor
      Found in src/core/common/BitArray.ts - 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 ((value & 0x40) === 0) {
                  canBeUTF8 = false;
                } else {
                  utf8BytesLeft++;
                  if ((value & 0x20) === 0) {
      Severity: Major
      Found in src/core/common/StringUtils.ts - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                  if (sjisCurKatakanaWordLength > sjisMaxKatakanaWordLength) {
                    sjisMaxKatakanaWordLength = sjisCurKatakanaWordLength;
                  }
        Severity: Major
        Found in src/core/common/StringUtils.ts - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if (maximizeY) {
                                      if (y > resY) {
                                          resY = y;
                                      }
                                  } else {
          Severity: Major
          Found in src/core/common/detector/CornerDetector.ts - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if (pixel > max) {
                                        max = pixel;
                                    }
            Severity: Major
            Found in src/core/common/HybridBinarizer.ts - About 45 mins to fix

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

                  function callback(exp: string | number, p0: any, p1: any, p2: any, p3: any, p4: any) {
              Severity: Minor
              Found in src/core/common/StringUtils.ts - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if (maximizeX) {
                                            if (x > resX) {
                                                resX = x;
                                            }
                                        } else {
                Severity: Major
                Found in src/core/common/detector/CornerDetector.ts - About 45 mins to fix

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

                      public decodeMiddle(row: BitArray, startRange: Int32Array, resultString: string) {
                          const counters = this.decodeMiddleCounters;
                          counters[0] = 0;
                          counters[1] = 0;
                          counters[2] = 0;
                  Severity: Minor
                  Found in src/core/oned/EAN8Reader.ts - 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 getValidRowData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private getValidRowData(row: BitArray): any {
                          let booleanArr = row.toArray();
                          let startIndex = booleanArr.indexOf(true);
                          if (startIndex === -1) return null;
                          let lastIndex = booleanArr.lastIndexOf(true);
                  Severity: Minor
                  Found in src/core/oned/CodaBarReader.ts - 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 (!evenParityBad) {
                                      throw new NotFoundException();
                                  }
                  Severity: Major
                  Found in src/core/oned/rss/RSS14Reader.ts - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                    if (evenParityBad) {
                                        throw new NotFoundException();
                                    }
                    Severity: Major
                    Found in src/core/oned/rss/RSS14Reader.ts - About 45 mins to fix

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

                        private parseBlocks(): DecodedInformation {
                          let isFinished: boolean;
                          let result: BlockParsedResult;
                          do {
                            let initialPosition = this.current.getPosition();
                      Severity: Minor
                      Found in src/core/oned/rss/expanded/decoders/GeneralAppIdDecoder.ts - 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 (!evenParityBad) {
                                throw new NotFoundException();
                              }
                      Severity: Major
                      Found in src/core/oned/rss/expanded/RSSExpandedReader.ts - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                        if (convertFNC1) {
                                          if (result.length === 0) {
                                            // GS1 specification 5.4.3.7. and 5.4.6.4. If the first char after the start code
                                            // is FNC1 then this is GS1-128. We add the symbology identifier.
                                            result += ']C1';
                        Severity: Major
                        Found in src/core/oned/Code128Reader.ts - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                      if (code !== Code128Reader.CODE_STOP) {
                                        lastCharacterWasPrintable = false;
                                      }
                          Severity: Major
                          Found in src/core/oned/Code128Reader.ts - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                            if (oddSum < evenSum) {
                                                incrementOdd = true;
                                                decrementEven = true;
                                            } else {
                                                decrementOdd = true;
                            Severity: Major
                            Found in src/core/oned/rss/RSS14Reader.ts - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                          if ((counter * 2) >= totalWideCountersWidth) {
                                            return -1;
                                          }
                              Severity: Major
                              Found in src/core/oned/Code39Reader.ts - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language