fujaba/NetworkParser

View on GitHub
src/main/java/de/uniks/networkparser/ext/story/CucumberStdRule.java

Summary

Maintainability
F
1 wk
Test Coverage

Method analyseSentense has a Cognitive Complexity of 169 (exceeds 5 allowed). Consider refactoring.
Open

    private boolean analyseSentense(String sentence, GraphModel model) {
        String[] token = sentence.split(" ");
        int z;
        /* Test for replace Link Names */
        if (assocs.size() > 0) {
Severity: Minor
Found in src/main/java/de/uniks/networkparser/ext/story/CucumberStdRule.java - About 3 days 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 analyseDefinition has a Cognitive Complexity of 117 (exceeds 5 allowed). Consider refactoring.
Open

    private boolean analyseDefinition(SimpleKeyValueList<String, Boolean> values) {
        for (int i = 0; i < values.size(); i++) {
            String string = values.getKeyByIndex(i);
            String[] token = string.split(" ");
            char[] types = new char[token.length];
Severity: Minor
Found in src/main/java/de/uniks/networkparser/ext/story/CucumberStdRule.java - About 2 days 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

File CucumberStdRule.java has 520 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package de.uniks.networkparser.ext.story;

import de.uniks.networkparser.ext.PatternCondition;
import de.uniks.networkparser.graph.Association;
import de.uniks.networkparser.graph.Attribute;
Severity: Major
Found in src/main/java/de/uniks/networkparser/ext/story/CucumberStdRule.java - About 1 day to fix

    Method analyseSentense has 185 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private boolean analyseSentense(String sentence, GraphModel model) {
            String[] token = sentence.split(" ");
            int z;
            /* Test for replace Link Names */
            if (assocs.size() > 0) {
    Severity: Major
    Found in src/main/java/de/uniks/networkparser/ext/story/CucumberStdRule.java - About 7 hrs to fix

      Method analyseTokenForAttribute has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

          private boolean analyseTokenForAttribute(String[] token) {
              if(token == null || token.length<1) {
                  return false;
              }
              int andPos=0, isPos = 0;
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/ext/story/CucumberStdRule.java - About 5 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 analyseDefinition has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private boolean analyseDefinition(SimpleKeyValueList<String, Boolean> values) {
              for (int i = 0; i < values.size(); i++) {
                  String string = values.getKeyByIndex(i);
                  String[] token = string.split(" ");
                  char[] types = new char[token.length];
      Severity: Major
      Found in src/main/java/de/uniks/networkparser/ext/story/CucumberStdRule.java - About 3 hrs to fix

        Method analyseTokenForAttribute has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private boolean analyseTokenForAttribute(String[] token) {
                if(token == null || token.length<1) {
                    return false;
                }
                int andPos=0, isPos = 0;
        Severity: Major
        Found in src/main/java/de/uniks/networkparser/ext/story/CucumberStdRule.java - About 2 hrs to fix

          Method getClazz has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              private Clazz getClazz(String id, GraphModel model) {
                  if(cucumber == null || model == null) {
                      return null;
                  }
                  id = cucumber.getDictionary(id);
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/ext/story/CucumberStdRule.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

          Avoid deeply nested control flow statements.
          Open

                                  if(this.analyseTokenForAttribute(token)) {
                                      break;
                                  }
          Severity: Major
          Found in src/main/java/de/uniks/networkparser/ext/story/CucumberStdRule.java - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    for (n = 0; n < z; n++) {
                                        newToken[n] = token[n];
                                    }
            Severity: Major
            Found in src/main/java/de/uniks/networkparser/ext/story/CucumberStdRule.java - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (elements.contains((Object) token[z - 1])) {
                                          transform = false;
                                      }
              Severity: Major
              Found in src/main/java/de/uniks/networkparser/ext/story/CucumberStdRule.java - About 45 mins to fix

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

                    protected SimpleSet<Token> splitText(String values) {
                        Token token = new Token().addKind(Token.UNKNOWN);
                        SimpleSet<Token> result = new SimpleSet<Token>();
                        for (int i = 0; i < values.length(); i++) {
                            char c = values.charAt(i);
                Severity: Minor
                Found in src/main/java/de/uniks/networkparser/ext/story/CucumberStdRule.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

                Avoid deeply nested control flow statements.
                Open

                                        if (types[z] == Token.NOMEN) {
                                            target = z;
                                            break;
                                        }
                Severity: Major
                Found in src/main/java/de/uniks/networkparser/ext/story/CucumberStdRule.java - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          while (temp < token.length) {
                                              newToken[n++] = token[temp++];
                                          }
                  Severity: Major
                  Found in src/main/java/de/uniks/networkparser/ext/story/CucumberStdRule.java - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            for (n = 0; n < elements.size(); n++) {
                                                newToken[n + temp] = elements.get(n).getId();
                                                if (n < elements.size() - 1) {
                                                    temp++;
                                                    newToken[n + temp] = "and";
                    Severity: Major
                    Found in src/main/java/de/uniks/networkparser/ext/story/CucumberStdRule.java - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if (token[z].startsWith(key)) {
                                                  found = n;
                                                  break;
                                              }
                      Severity: Major
                      Found in src/main/java/de/uniks/networkparser/ext/story/CucumberStdRule.java - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if (types[z] == Token.NOMEN) {
                                                    source = z;
                                                    break;
                                                }
                        Severity: Major
                        Found in src/main/java/de/uniks/networkparser/ext/story/CucumberStdRule.java - About 45 mins to fix

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

                              private ObjectCondition analysePattern(And parent, Clazz clazz, SimpleSet<GraphMember> visited) {
                                  if(clazz == null) {
                                      return null;
                                  }
                                  if(visited.add(clazz) == false) {
                          Severity: Minor
                          Found in src/main/java/de/uniks/networkparser/ext/story/CucumberStdRule.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

                          FIXME found
                          Open

                                              //FIXME add AND POS

                          FIXME found
                          Open

                                      //FIXME AND INCLUDE VISITED

                          These nested if statements could be combined
                          Open

                                                  if (elements.contains((Object) token[z - 1])) {
                                                      transform = false;
                                                  }

                          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(this.analyseTokenForAttribute(token)) {
                                                      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
                           }
                          }

                          Avoid using a branching statement as the last in a loop.
                          Open

                                      break;

                          AvoidBranchingStatementAsLastInLoop

                          Since: PMD 5.0

                          Priority: Medium High

                          Categories: Style

                          Remediation Points: 50000

                          Using a branching statement as the last part of a loop may be a bug, and/or is confusing. Ensure that the usage is not a bug, or consider using another approach.

                          Example:

                          // unusual use of branching statement in a loop
                          for (int i = 0; i < 10; i++) {
                           if (i*i <= 25) {
                           continue;
                           }
                           break;
                          }
                          
                          // this makes more sense...
                          for (int i = 0; i < 10; i++) {
                           if (i*i > 25) {
                           break;
                           }
                          }

                          There are no issues that match your filters.

                          Category
                          Status