fujaba/NetworkParser

View on GitHub
src/main/java/de/uniks/networkparser/ext/generic/SimpleParser.java

Summary

Maintainability
D
2 days
Test Coverage

Method decodingModel has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

    private static Object decodingModel(Buffer buffer, IdMap map, Tokener tokener, char endTag) {
        if (buffer == null) {
            return null;
        }
        String className = null;
Severity: Minor
Found in src/main/java/de/uniks/networkparser/ext/generic/SimpleParser.java - About 7 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 decodingModel has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static Object decodingModel(Buffer buffer, IdMap map, Tokener tokener, char endTag) {
        if (buffer == null) {
            return null;
        }
        String className = null;
Severity: Major
Found in src/main/java/de/uniks/networkparser/ext/generic/SimpleParser.java - About 2 hrs to fix

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

        public <T> T decode(Object json, Class<T> classOfT) {
            JsonObject jsonObject = null;
            if (json instanceof String) {
                jsonObject = new JsonObject().withValue((String) json);
            } else if (json instanceof JsonObject) {
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/ext/generic/SimpleParser.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 decode has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public <T> T decode(Object json, Class<T> classOfT) {
            JsonObject jsonObject = null;
            if (json instanceof String) {
                jsonObject = new JsonObject().withValue((String) json);
            } else if (json instanceof JsonObject) {
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/ext/generic/SimpleParser.java - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                              if (key.length() < 1) {
                                  break;
                              }
      Severity: Major
      Found in src/main/java/de/uniks/networkparser/ext/generic/SimpleParser.java - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if (buffer.getCurrentChar() == propStartTag) {
                                    /* new Subtype */
                                    Object subElement = decodingModel(buffer, map, tokener, propEndTag);
                                    creator.setValue(result, key, subElement, SendableEntityCreator.NEW);
                                } else if (buffer.getCurrentChar() == JsonArray.START) {
        Severity: Major
        Found in src/main/java/de/uniks/networkparser/ext/generic/SimpleParser.java - About 45 mins to fix

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

              public static <T> T decodeModel(Buffer buffer, IdMap map) {
                  if (buffer == null || map == null) {
                      return null;
                  }
                  char firstChar = buffer.nextClean(true);
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/ext/generic/SimpleParser.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 classOfT.cast(result);
          Severity: Major
          Found in src/main/java/de/uniks/networkparser/ext/generic/SimpleParser.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/ext/generic/SimpleParser.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/ext/generic/SimpleParser.java - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status