fujaba/NetworkParser

View on GitHub
src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java

Summary

Maintainability
F
1 wk
Test Coverage

File QRTokener.java has 879 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package de.uniks.networkparser.bytes.qr;

/*
NetworkParser
The MIT License
Severity: Major
Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 2 days to fix

    Method decode has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

        public DecoderResult decode(Object values) {
            if (values == null) {
                return null;
            }
    
    
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 6 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

    QRTokener has 44 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class QRTokener {
        private final ReedSolomon rsDecoder = new ReedSolomon(GenericGF.QR_CODE_FIELD_256);
    
        /* The original table is defined in the table 5 of JISX0510:2004 (p.19). */
        private static final int[] ALPHANUMERIC_TABLE = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 6 hrs to fix

      Method embedDataBits has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          private static boolean embedDataBits(BitArray dataBits, int maskPattern, ByteMatrix matrix) {
              if (dataBits == null || matrix == null) {
                  return false;
              }
              int bitIndex = 0;
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 3 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

      Method decode has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public DecoderResult decode(Object values) {
              if (values == null) {
                  return null;
              }
      
      
      Severity: Major
      Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 3 hrs to fix

        Method applyMaskPenaltyRule1Internal has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            private static int applyMaskPenaltyRule1Internal(ByteMatrix matrix, boolean isHorizontal) {
                if (matrix == null) {
                    return -1;
                }
                int penalty = 0;
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - 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

        Method interleaveWithECBytes has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            static BitArray interleaveWithECBytes(BitArray bits, int numTotalBytes, int numDataBytes, int numRSBlocks) {
                /* "bits" must have "getNumDataBytes" bytes of data. */
                if (bits == null || bits.getSizeInBytes() != numDataBytes) {
                    return null;
                }
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - 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

        Consider simplifying this complex logical expression.
        Open

                        if (x + 6 < width && arrayY[x] == 1 && arrayY[x + 1] == 0 && arrayY[x + 2] == 1 && arrayY[x + 3] == 1
                                && arrayY[x + 4] == 1 && arrayY[x + 5] == 0 && arrayY[x + 6] == 1
                                && (isWhiteHorizontal(arrayY, x - 4, x) || isWhiteHorizontal(arrayY, x + 7, x + 11))) {
                            numPenalties++;
                        }
        Severity: Critical
        Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 2 hrs to fix

          Consider simplifying this complex logical expression.
          Open

                          if (y + 6 < height && array[y][x] == 1 && array[y + 1][x] == 0 && array[y + 2][x] == 1
                                  && array[y + 3][x] == 1 && array[y + 4][x] == 1 && array[y + 5][x] == 0 && array[y + 6][x] == 1
                                  && (isWhiteVertical(array, x, y - 4, y) || isWhiteVertical(array, x, y + 7, y + 11))) {
                              numPenalties++;
                          }
          Severity: Critical
          Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 2 hrs to fix

            Method interleaveWithECBytes has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                static BitArray interleaveWithECBytes(BitArray bits, int numTotalBytes, int numDataBytes, int numRSBlocks) {
                    /* "bits" must have "getNumDataBytes" bytes of data. */
                    if (bits == null || bits.getSizeInBytes() != numDataBytes) {
                        return null;
                    }
            Severity: Minor
            Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 1 hr to fix

              Method applyMaskPenaltyRule3 has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static int applyMaskPenaltyRule3(ByteMatrix matrix) {
                      if (matrix == null) {
                          return -1;
                      }
                      int numPenalties = 0;
              Severity: Minor
              Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - 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

              Method maybeEmbedPositionAdjustmentPatterns has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static void maybeEmbedPositionAdjustmentPatterns(Version version, ByteMatrix matrix) {
                      if (version == null || matrix == null) {
                          return;
                      }
                      if (version.getVersionNumber() < 2) { /* The patterns appear if version >= 2 */
              Severity: Minor
              Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - 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

              Method encode has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public QRCode encode(String content, ErrorCorrectionLevel ecLevel) {
                      String encoding = DEFAULT_BYTE_MODE_ENCODING;
                      /*
                       * Determine what character encoding has been specified by the caller, if any
                       * Pick an encoding mode appropriate for the content. Note that this will not
              Severity: Minor
              Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 1 hr to fix

                Method embedDataBits has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private static boolean embedDataBits(BitArray dataBits, int maskPattern, ByteMatrix matrix) {
                        if (dataBits == null || matrix == null) {
                            return false;
                        }
                        int bitIndex = 0;
                Severity: Minor
                Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 1 hr to fix

                  Method getDataMaskBit has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      static boolean getDataMaskBit(int maskPattern, int x, int y) {
                          int intermediate;
                          int temp;
                          switch (maskPattern) {
                          case 0:
                  Severity: Minor
                  Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 1 hr to fix

                    Method appendAlphanumericBytes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        static boolean appendAlphanumericBytes(CharSequence content, BitArray bits) {
                            if (content == null || bits == null) {
                                return false;
                            }
                            int length = content.length();
                    Severity: Minor
                    Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - 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

                    Method appendKanjiBytes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        static boolean appendKanjiBytes(String content, BitArray bits) {
                            if (content == null || bits == null) {
                                return false;
                            }
                            byte[] bytes;
                    Severity: Minor
                    Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - 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

                    Method chooseMode has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static Mode chooseMode(String content, String encoding) {
                            if ("Shift_JIS".equals(encoding) && isOnlyDoubleByteKanji(content)) {
                                /* Choose Kanji mode if all input are double-byte characters */
                                return Mode.KANJI;
                            }
                    Severity: Minor
                    Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - 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

                    Method appendKanjiBytes has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        static boolean appendKanjiBytes(String content, BitArray bits) {
                            if (content == null || bits == null) {
                                return false;
                            }
                            byte[] bytes;
                    Severity: Minor
                    Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 1 hr to fix

                      Method applyMaskPenaltyRule1Internal has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private static int applyMaskPenaltyRule1Internal(ByteMatrix matrix, boolean isHorizontal) {
                              if (matrix == null) {
                                  return -1;
                              }
                              int penalty = 0;
                      Severity: Minor
                      Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 1 hr to fix

                        Method isOnlyDoubleByteKanji has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private static boolean isOnlyDoubleByteKanji(String content) {
                                if (content == null) {
                                    return false;
                                }
                                byte[] bytes;
                        Severity: Minor
                        Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 55 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

                        Method applyMaskPenaltyRule2 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            static int applyMaskPenaltyRule2(ByteMatrix matrix) {
                                if (matrix == null) {
                                    return -1;
                                }
                                int penalty = 0;
                        Severity: Minor
                        Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - 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

                        Method getNumDataBytesAndNumECBytesForBlockID has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            static boolean getNumDataBytesAndNumECBytesForBlockID(int numTotalBytes, int numDataBytes, int numRSBlocks,
                                    int blockID, int[] numDataBytesInBlock, int[] numECBytesInBlock) {
                        Severity: Minor
                        Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 45 mins to fix

                          Method terminateBits has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              static boolean terminateBits(int numDataBytes, BitArray bits) {
                                  int capacity = numDataBytes * 8;
                                  if (bits == null || bits.getSize() > capacity) {
                                      return false; /* "data bits cannot fit in the QR Code" + bits.getSize() + " > " + capacity */
                                  }
                          Severity: Minor
                          Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - 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

                          Method applyMaskPenaltyRule4 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private static int applyMaskPenaltyRule4(ByteMatrix matrix) {
                                  if (matrix == null) {
                                      return -1;
                                  }
                                  int numDarkCells = 0;
                          Severity: Minor
                          Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - 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

                          Method buildMatrix has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              private static boolean buildMatrix(BitArray dataBits, ErrorCorrectionLevel ecLevel, Version version,
                                      int maskPattern, ByteMatrix matrix) {
                          Severity: Minor
                          Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 35 mins to fix

                            Method append8BitBytes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                static boolean append8BitBytes(String content, BitArray bits, String encoding) {
                                    if (content == null) {
                                        return false;
                                    }
                                    byte[] bytes = null;
                            Severity: Minor
                            Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 35 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

                            Method appendNumericBytes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                static boolean appendNumericBytes(CharSequence content, BitArray bits) {
                                    if (content == null || bits == null) {
                                        return false;
                                    }
                                    int length = content.length();
                            Severity: Minor
                            Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 35 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 too many return statements within this method.
                            Open

                                    return Mode.BYTE;
                            Severity: Major
                            Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                      return false;
                              Severity: Major
                              Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                            return result;
                                Severity: Major
                                Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                              return Mode.NUMERIC;
                                  Severity: Major
                                  Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                            return true;
                                    Severity: Major
                                    Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                              return decode(bits);
                                      Severity: Major
                                      Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                        return result;
                                        Severity: Major
                                        Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                  return true;
                                          Severity: Major
                                          Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                        return null;
                                            Severity: Major
                                            Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 30 mins to fix

                                              Method getNumDataBytesAndNumECBytesForBlockID has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  static boolean getNumDataBytesAndNumECBytesForBlockID(int numTotalBytes, int numDataBytes, int numRSBlocks,
                                                          int blockID, int[] numDataBytesInBlock, int[] numECBytesInBlock) {
                                                      if (blockID >= numRSBlocks) {
                                                          return false; /* "Block ID too large"; */
                                                      }
                                              Severity: Minor
                                              Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 25 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

                                              Method chooseVersion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  private static Version chooseVersion(int numInputBits, ErrorCorrectionLevel ecLevel) {
                                                      /* In the following comments, we use numbers of Version 7-H. */
                                                      for (int versionNum = 1; versionNum <= 40; versionNum++) {
                                                          Version version = Version.getVersionForNumber(versionNum);
                                                          /* numBytes = 196 */
                                              Severity: Minor
                                              Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 25 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

                                              Method embedTimingPatterns has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  private static boolean embedTimingPatterns(ByteMatrix matrix) {
                                                      if (matrix == null) {
                                                          return false;
                                                      }
                                                      /*
                                              Severity: Minor
                                              Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 25 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

                                              Method embedPositionDetectionPattern has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  private static void embedPositionDetectionPattern(int xStart, int yStart, ByteMatrix matrix) {
                                                      if (matrix != null) {
                                                          for (int y = 0; y < 7; ++y) {
                                                              for (int x = 0; x < 7; ++x) {
                                                                  matrix.set(xStart + x, yStart + y, POSITION_DETECTION_PATTERN[y][x]);
                                              Severity: Minor
                                              Found in src/main/java/de/uniks/networkparser/bytes/qr/QRTokener.java - About 25 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

                                              There are no issues that match your filters.

                                              Category
                                              Status