fujaba/NetworkParser

View on GitHub
src/main/java/de/uniks/networkparser/parser/TemplateResultFile.java

Summary

Maintainability
F
3 days
Test Coverage

Method toString has a Cognitive Complexity of 95 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public String toString() {
        SourceCode code = getCode();
        if (this.size() < 1) {
            if (code != null) {
Severity: Minor
Found in src/main/java/de/uniks/networkparser/parser/TemplateResultFile.java - About 1 day 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 toString has 101 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public String toString() {
        SourceCode code = getCode();
        if (this.size() < 1) {
            if (code != null) {
Severity: Major
Found in src/main/java/de/uniks/networkparser/parser/TemplateResultFile.java - About 4 hrs to fix

    File TemplateResultFile.java has 304 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package de.uniks.networkparser.parser;
    
    import de.uniks.networkparser.EntityUtil;
    /*
    The MIT License
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/parser/TemplateResultFile.java - About 3 hrs to fix

      TemplateResultFile has 23 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public class TemplateResultFile extends SortedSet<TemplateResultFragment>
              implements SendableEntityCreator, LocalisationInterface {
          public static final String PROPERTY_PARENT = "parent";
          public static final String PROPERTY_CHILD = "child";
          public static final String PROPERTY_MEMBER = "member";
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/parser/TemplateResultFile.java - About 2 hrs to fix

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

            @Override
            public Object getValue(Object entity, String attribute) {
                if (entity instanceof TemplateResultFile == false) {
                    return null;
                }
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/parser/TemplateResultFile.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 getValue has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public Object getValue(Object entity, String attribute) {
                if (entity instanceof TemplateResultFile == false) {
                    return null;
                }
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/parser/TemplateResultFile.java - About 1 hr to fix

          Avoid deeply nested control flow statements.
          Open

                                  if (symbolEntry == null) {
                                      int pos = code.getEndOfBody();
                                      sb.replace(pos, pos, fragment.getValue().toString());
                                  }
          Severity: Major
          Found in src/main/java/de/uniks/networkparser/parser/TemplateResultFile.java - About 45 mins to fix

            Avoid too many return statements within this method.
            Open

                        return headers;
            Severity: Major
            Found in src/main/java/de/uniks/networkparser/parser/TemplateResultFile.java - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return member;
              Severity: Major
              Found in src/main/java/de/uniks/networkparser/parser/TemplateResultFile.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/parser/TemplateResultFile.java - About 30 mins to fix

                  FIXME found
                  Open

                          /* FIXME FOR NON COMPARATOR */

                  TODO found
                  Open

                          /* TODO DONT ADD CORRECTLY ADD */

                  These nested if statements could be combined
                  Open

                                              if (entry.getName().equals(fragment.getMember().getName())) {
                                                  part = fragment;
                                                  break;
                                              }

                  CollapsibleIfStatements

                  Since: PMD 3.1

                  Priority: Medium

                  Categories: Style

                  Remediation Points: 50000

                  Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

                  Example:

                  void bar() {
                   if (x) { // original implementation
                   if (y) {
                   // do stuff
                   }
                   }
                  }
                  
                  void bar() {
                   if (x && y) { // optimized implementation
                   // do stuff
                   }
                  }

                  These nested if statements could be combined
                  Open

                              if (code != null) {
                                  String codeString = code.toString();
                                  if (codeString != null && codeString.length() > 0) {
                                      return code.toString();
                                  }

                  CollapsibleIfStatements

                  Since: PMD 3.1

                  Priority: Medium

                  Categories: Style

                  Remediation Points: 50000

                  Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

                  Example:

                  void bar() {
                   if (x) { // original implementation
                   if (y) {
                   // do stuff
                   }
                   }
                  }
                  
                  void bar() {
                   if (x && y) { // optimized implementation
                   // do stuff
                   }
                  }

                  There are no issues that match your filters.

                  Category
                  Status