Method getValue
has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring. Open
public Object getValue(String attribute) {
if (attribute == null) {
return null;
}
if (PROPERTY_PATH.equalsIgnoreCase(attribute)) {
- 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 GraphMember.java
has 388 lines of code (exceeds 250 allowed). Consider refactoring. Open
package de.uniks.networkparser.graph;
import java.util.Collection;
import de.uniks.networkparser.buffer.CharacterBuffer;
Method getValue
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Object getValue(String attribute) {
if (attribute == null) {
return null;
}
if (PROPERTY_PATH.equalsIgnoreCase(attribute)) {
Method withAnnotation
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected GraphMember withAnnotation(Annotation value) {
/* Remove Old GraphAnnotation */
if (this.children != null) {
if (this.children instanceof GraphMember) {
if (this.children instanceof Annotation) {
- 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 withChildren
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
GraphMember withChildren(GraphMember... values) {
/* Do Nothing */
if (values == null || (values.length == 1 && (this.children == values[0]))) {
return this;
}
- 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 remove
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public boolean remove(GraphMember member) {
if (member == null) {
return true;
}
if (this.children instanceof GraphSimpleSet) {
- 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 withModifier
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected GraphMember withModifier(Modifier... values) {
if (values == null) {
return this;
}
Modifier rootModifier = getModifier();
- 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 withChildren
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
GraphMember withChildren(GraphMember... values) {
/* Do Nothing */
if (values == null || (values.length == 1 && (this.children == values[0]))) {
return this;
}
Method getAnnotation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected Annotation getAnnotation() {
if (this.children == null) {
return null;
}
if (this.children instanceof Annotation) {
- 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 (oldValue != null) {
oldValue.setParentNode(null);
}
Method getNodes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected SimpleSet<GraphEntity> getNodes() {
SimpleSet<GraphEntity> collection = new SimpleSet<GraphEntity>();
if (this.children == null) {
return collection;
}
- 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 getModifier
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public Modifier getModifier() {
if (this.children == null) {
return null;
}
if (this.children instanceof Modifier) {
- 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 too many return
statements within this method. Open
return getValue(PROPERTY_PARENT);
Avoid too many return
statements within this method. Open
return item.getValue(attribute.substring(pos + 1));
Avoid too many return
statements within this method. Open
return this.name;
Avoid too many return
statements within this method. Open
return children.getValue(attribute.substring(pos + 1));
Avoid too many return
statements within this method. Open
return "";
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return item.getValue(attribute.substring(pos + 1));
Avoid too many return
statements within this method. Open
return annotation;
Avoid too many return
statements within this method. Open
return buffer.toString();
Avoid too many return
statements within this method. Open
return this.getClass().getName();
Avoid too many return
statements within this method. Open
return literals;
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return children;
Avoid too many return
statements within this method. Open
return this.parentNode;
Avoid too many return
statements within this method. Open
return getClass().getSimpleName().toLowerCase();
Avoid too many return
statements within this method. Open
return this.children;
Avoid too many return
statements within this method. Open
return literals.getValue(attribute.substring(pos + 1));
Avoid too many return
statements within this method. Open
return PROPERTY_THIS;
These nested if statements could be combined Open
if (this.children instanceof Annotation) {
((Annotation) this.children).setParentNode(null);
this.children = null;
}
- 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 (list.add(value)) {
value.setParentNode(this);
}
- 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 (values.length == 1) {
this.children = values[0];
((GraphMember) values[0]).setParentNode(this);
return this;
}
- 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
}
}