zxing-js/library

View on GitHub

Showing 605 of 958 total issues

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

export default function createDecoder(information: BitArray): AbstractExpandedDecoder {
  try {
    if (information.get(1)) {
      return new AI01AndOtherAIs(information);

Severity: Minor
Found in src/core/oned/rss/expanded/decoders/createDecoder.ts - About 1 hr to fix

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

    export function createDecoder(information: BitArray): AbstractExpandedDecoder {
      try {
        if (information.get(1)) {
          return new AI01AndOtherAIs(information);
    
    

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

        public static convertUPCEtoUPCA(upce: string): string {
          // the following line is equivalent to upce.getChars(1, 7, upceChars, 0);
          const upceChars = upce.slice(1, 7).split('').map(x => x.charCodeAt(0));
          const result: StringBuilder = new StringBuilder(/*12*/);
          result.append(upce.charAt(0));
      Severity: Minor
      Found in src/core/oned/UPCEReader.ts - About 1 hr to fix

        Function encodeHighLevel has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          public static encodeHighLevel(
            msg: string,
            shape = SymbolShapeHint.FORCE_NONE,
            minSize: Dimension = null,
            maxSize: Dimension = null,
        Severity: Minor
        Found in src/core/datamatrix/encoder/HighLevelEncoder.ts - About 1 hr 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 encodeMaximal has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          encodeMaximal(context: EncoderContext): void {
            const buffer = new StringBuilder();
            let lastCharSize = 0;
            let backtrackStartPosition = context.pos;
            let backtrackBufferLength = 0;
        Severity: Minor
        Found in src/core/datamatrix/encoder/C40Encoder.ts - About 1 hr 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 getEDFBytes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          getEDFBytes(): Uint8Array {
            const numberOfThirds = Math.ceil(this.characterLength / 4.0);
            const result = new Uint8Array(numberOfThirds * 3);
            let pos = this.fromPosition;
            const endPos = Math.min(
        Severity: Minor
        Found in src/core/datamatrix/encoder/MinimalEncoder.ts - About 1 hr 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 maybeEmbedPositionAdjustmentPatterns has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            private static maybeEmbedPositionAdjustmentPatterns(version: Version, matrix: ByteMatrix): void {
                if (version.getVersionNumber() < 2) {  // The patterns appear if version >= 2
                    return;
                }
                const index = version.getVersionNumber() - 1;
        Severity: Minor
        Found in src/core/qrcode/encoder/MatrixUtil.ts - About 1 hr 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 calculateThresholdForBlock has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            private static calculateThresholdForBlock(luminances: Uint8ClampedArray,
                subWidth: number /*int*/,
                subHeight: number /*int*/,
                width: number /*int*/,
                height: number /*int*/,
        Severity: Minor
        Found in src/core/common/HybridBinarizer.ts - About 1 hr 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 stuffBits has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          static stuffBits(bits: BitArray, wordSize: int): BitArray {
            let out: BitArray = new BitArray();
        
            let n: int = bits.getSize();
            let mask: int = (1 << wordSize) - 2;
        Severity: Minor
        Found in src/core/aztec/encoder/Encoder.ts - About 1 hr 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 simplifyStates has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          private static simplifyStates(states: State[]): Collection<State> {
            let result: Collection<State> = [];
            for (const newState of states) {
              let add: boolean = true;
              for (const oldState of result) {
        Severity: Minor
        Found in src/core/aztec/encoder/HighLevelEncoder.ts - About 1 hr 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 toPattern has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          private toPattern(counters: Int32Array): number {
            let sum = 0;
            for (const counter of counters) {
              sum += counter;
            }
        Severity: Minor
        Found in src/core/oned/Code93Reader.ts - About 1 hr 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 decodeRow has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public decodeRow(rowNumber: number, row: BitArray, hints?: Map<DecodeHintType, any>): Result {
                const leftPair = this.decodePair(row, false, rowNumber, hints);
                RSS14Reader.addOrTally(this.possibleLeftPairs, leftPair);
                row.reverse();
                let rightPair = this.decodePair(row, true, rowNumber, hints);
        Severity: Minor
        Found in src/core/oned/rss/RSS14Reader.ts - About 1 hr 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 constructor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          public constructor(hints?: Map<DecodeHintType, any>) {
            super();
            let possibleFormats = hints == null ? null : <BarcodeFormat[]>hints.get(DecodeHintType.POSSIBLE_FORMATS);
            let readers: Collection<UPCEANReader> = [];
            if (possibleFormats != null) {
        Severity: Minor
        Found in src/core/oned/MultiFormatUPCEANReader.ts - About 1 hr 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 detect has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public detect(): DetectorResult {
        
        
            const cornerPoints = this.rectangleDetector.detect();
        
        
        Severity: Minor
        Found in src/core/datamatrix/detector/Detector.ts - About 1 hr to fix

          Function getNumDataBytesAndNumECBytesForBlockID has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static getNumDataBytesAndNumECBytesForBlockID(numTotalBytes: number /*int*/,
                  numDataBytes: number /*int*/,
                  numRSBlocks: number /*int*/,
                  blockID: number /*int*/,
                  numDataBytesInBlock: Int32Array,
          Severity: Minor
          Found in src/core/qrcode/encoder/Encoder.ts - About 1 hr to fix

            Function detectSolid1 has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private detectSolid1(cornerPoints: ResultPoint[]): ResultPoint[] {
                // 0  2
                // 1  3
                let pointA = cornerPoints[0];
                let pointB = cornerPoints[1];
            Severity: Minor
            Found in src/core/datamatrix/detector/Detector.ts - About 1 hr to fix

              Function getStartColumn has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private static getStartColumn(detectionResult: DetectionResult,
                  barcodeColumn: int,
                  imageRow: int,
                  leftToRight: boolean): int {
                  let offset: int = leftToRight ? 1 : -1;
              Severity: Minor
              Found in src/core/pdf417/decoder/PDF417ScanningDecoder.ts - About 1 hr to fix

                Function addMissingRows has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  addMissingRows(missingStartRows: int, missingEndRows: int, isLeft: boolean): BoundingBox {
                    let newTopLeft: ResultPoint = this.topLeft;
                    let newBottomLeft: ResultPoint = this.bottomLeft;
                    let newTopRight: ResultPoint = this.topRight;
                    let newBottomRight: ResultPoint = this.bottomRight;
                Severity: Minor
                Found in src/core/pdf417/decoder/BoundingBox.ts - About 1 hr to fix

                  Function extractParameters has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private extractParameters(bullsEyeCorners: ResultPoint[]): void {
                          if (!this.isValidPoint(bullsEyeCorners[0]) || !this.isValidPoint(bullsEyeCorners[1]) ||
                              !this.isValidPoint(bullsEyeCorners[2]) || !this.isValidPoint(bullsEyeCorners[3])) {
                              throw new NotFoundException();
                          }
                  Severity: Minor
                  Found in src/core/aztec/detector/Detector.ts - About 1 hr to fix

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

                      private extractDataRegion(bitMatrix: BitMatrix): BitMatrix {
                        const symbolSizeRows = this.version.getSymbolSizeRows();
                        const symbolSizeColumns = this.version.getSymbolSizeColumns();
                    
                        if (bitMatrix.getHeight() !== symbolSizeRows) {
                    Severity: Minor
                    Found in src/core/datamatrix/decoder/BitMatrixParser.ts - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language