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) {
- Read upRead up
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];
- Read upRead up
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;
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) {
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;
- Read upRead up
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];
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;
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);
- Read upRead up
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;
}
Avoid deeply nested control flow statements. Open
for (n = 0; n < z; n++) {
newToken[n] = token[n];
}
Avoid deeply nested control flow statements. Open
if (elements.contains((Object) token[z - 1])) {
transform = false;
}
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);
- Read upRead up
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;
}
Avoid deeply nested control flow statements. Open
while (temp < token.length) {
newToken[n++] = token[temp++];
}
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";
Avoid deeply nested control flow statements. Open
if (token[z].startsWith(key)) {
found = n;
break;
}
Avoid deeply nested control flow statements. Open
if (types[z] == Token.NOMEN) {
source = z;
break;
}
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) {
- Read upRead up
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
- Exclude checks
FIXME found Open
//FIXME AND INCLUDE VISITED
- Exclude checks
These nested if statements could be combined Open
if (elements.contains((Object) token[z - 1])) {
transform = false;
}
- Read upRead up
- Exclude checks
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;
}
- Read upRead up
- Exclude checks
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;
- Read upRead up
- Exclude checks
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;
}
}