fujaba/NetworkParser

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

Summary

Maintainability
F
4 days
Test Coverage

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

    static DecoderResult decode(byte[] bytes, Version version, ErrorCorrectionLevel ecLevel) {
        BitArray bits = new BitArray(bytes);
        CharacterBuffer result = new CharacterBuffer().withBufferLength(50);
        List<byte[]> byteSegments = new ArrayList<byte[]>(1);
        int symbolSequence = -1;

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

    private static boolean decodeNumericSegment(BitArray bits, CharacterBuffer result, int count) {
        /* Read three digits at a time */
        if (bits == null || result == null) {
            return false;
        }

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

    private static boolean decodeAlphanumericSegment(BitArray bits, CharacterBuffer result, int count,
            boolean fc1InEffect) {
        /* Read two characters at a time */
        if (bits == null) {
            return false;

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

    private static boolean decodeNumericSegment(BitArray bits, CharacterBuffer result, int count) {
        /* Read three digits at a time */
        if (bits == null || result == null) {
            return false;
        }

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

        static DecoderResult decode(byte[] bytes, Version version, ErrorCorrectionLevel ecLevel) {
            BitArray bits = new BitArray(bytes);
            CharacterBuffer result = new CharacterBuffer().withBufferLength(50);
            List<byte[]> byteSegments = new ArrayList<byte[]>(1);
            int symbolSequence = -1;

      File DecodedBitStreamParser.java has 259 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      package de.uniks.networkparser.bytes.qr;
      
      import java.io.UnsupportedEncodingException;
      import java.nio.charset.Charset;
      import java.util.ArrayList;

        Method decodeAlphanumericSegment has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private static boolean decodeAlphanumericSegment(BitArray bits, CharacterBuffer result, int count,
                    boolean fc1InEffect) {
                /* Read two characters at a time */
                if (bits == null) {
                    return false;

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

              private static boolean decodeHanziSegment(BitArray bits, CharacterBuffer result, int count) {
                  /* Don't crash trying to read more bits than we have available. */
                  if (bits == null || count * 13 > bits.available()) {
                      return false;
                  }

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

              private static boolean decodeKanjiSegment(BitArray bits, CharacterBuffer result, int count) {
                  /* Don't crash trying to read more bits than we have available. */
                  if (bits == null || count * 13 > bits.available()) {
                      return false;
                  }

          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 true;

            Avoid too many return statements within this method.
            Open

                            return false;

              Avoid too many return statements within this method.
              Open

                      return true;

                Avoid too many return statements within this method.
                Open

                                return false;

                  Avoid too many return statements within this method.
                  Open

                                  return false;

                    Avoid too many return statements within this method.
                    Open

                                    return false;

                      Avoid too many return statements within this method.
                      Open

                                      return false;

                        Avoid too many return statements within this method.
                        Open

                                                        return null;

                          Avoid too many return statements within this method.
                          Open

                                  return new DecoderResult(bytes, result.toString(), byteSegments.isEmpty() ? null : byteSegments,
                                          ecLevel == null ? null : ecLevel.toString(), symbolSequence, parityData);

                            Avoid too many return statements within this method.
                            Open

                                            return false;

                              Avoid too many return statements within this method.
                              Open

                                              return false;

                                Avoid too many return statements within this method.
                                Open

                                                return false;

                                  Avoid too many return statements within this method.
                                  Open

                                                  return false;

                                    Avoid too many return statements within this method.
                                    Open

                                                    return false;

                                      Avoid too many return statements within this method.
                                      Open

                                                      return false;

                                        There are no issues that match your filters.

                                        Category
                                        Status