fujaba/NetworkParser

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

Summary

Maintainability
C
1 day
Test Coverage

Method getVersionForNumber has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static Version getVersionForNumber(int versionNumber) {
        if (versionNumber < 1 || versionNumber > 40) {
            return null;
        }
        if (VERSIONS == null) {
Severity: Major
Found in src/main/java/de/uniks/networkparser/bytes/qr/Version.java - About 3 hrs to fix

    File Version.java has 261 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package de.uniks.networkparser.bytes.qr;
    
    import de.uniks.networkparser.json.JsonArray;
    import de.uniks.networkparser.json.JsonObject;
    
    
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/bytes/qr/Version.java - About 2 hrs to fix

      Method buildFunctionPattern has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          BitMatrix buildFunctionPattern() {
              if (alignmentPatternCenters == null) {
                  return null;
              }
              int dimension = getDimensionForVersion();
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/bytes/qr/Version.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 getECBS has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          ECB getECBS(JsonObject jsonObject, int index) {
              if (jsonObject == null || jsonObject.size() < 1) {
                  return new ECB(-1, -1, -1);
              }
              int ecCodeBlocks = Integer.valueOf(jsonObject.getKeyByIndex(index));
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/bytes/qr/Version.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 ecBlocks4;
      Severity: Major
      Found in src/main/java/de/uniks/networkparser/bytes/qr/Version.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/Version.java - About 30 mins to fix

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

              static Version decodeVersionInformation(int versionBits) {
                  int bestDifference = Integer.MAX_VALUE;
                  int bestVersion = 0;
                  for (int i = 0; i < VERSION_DECODE_INFO.length; i++) {
                      int targetVersion = VERSION_DECODE_INFO[i];
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/bytes/qr/Version.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