Method with
has a Cognitive Complexity of 113 (exceeds 5 allowed). Consider refactoring. Open
protected GraphEntity with(Association... values) {
if (values != null) {
boolean add;
AssociationSet allAssoc;
for (Association assoc : values) {
- 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 getEdges
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
AssociationSet getEdges(AssociationTypes type, Condition<?>... filters) {
if (this.children == null || type == null) {
return AssociationSet.EMPTY_SET;
}
AssociationSet collection = new AssociationSet();
- 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 with
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected GraphEntity with(Association... values) {
if (values != null) {
boolean add;
AssociationSet allAssoc;
for (Association assoc : values) {
File GraphEntity.java
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
package de.uniks.networkparser.graph;
import de.uniks.networkparser.interfaces.Condition;
public abstract class GraphEntity extends GraphMember {
Method getByObject
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected GraphMember getByObject(String clazz, boolean fullName) {
if (clazz == null || children == null) {
return null;
}
String sub = clazz;
- 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 getChildByName
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public GraphMember getChildByName(String name, Class<?> subClass) {
if (this.children == null) {
return null;
}
GraphSimpleSet children = this.getChildren();
- 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 getName
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public String getName(boolean shortName) {
if (this.name == null) {
return null;
}
if (shortName == 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
Method getByObject
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected GraphMember getByObject(String clazz, boolean fullName) {
if (clazz == null || children == null) {
return null;
}
String sub = clazz;
Method getEdges
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
AssociationSet getEdges(AssociationTypes type, Condition<?>... filters) {
if (this.children == null || type == null) {
return AssociationSet.EMPTY_SET;
}
AssociationSet collection = new AssociationSet();
Consider simplifying this complex logical expression. Open
if (values != null) {
boolean add;
AssociationSet allAssoc;
for (Association assoc : values) {
/* Do Nothing */
Avoid deeply nested control flow statements. Open
if (this.parentNode instanceof GraphModel) {
((GraphModel) this.parentNode).with(assoc);
}
Avoid deeply nested control flow statements. Open
if (item != assoc) {
add = false;
}
Avoid deeply nested control flow statements. Open
if (itemOther.getClazz() == assocOther.getClazz() && item.getClazz() == assoc.getClazz()) {
add = false;
if (assocOther.name() != null && assoc.name() == null) {
if (itemOther.getType() == AssociationTypes.EDGE
&& item.getType() == AssociationTypes.ASSOCIATION) {
Avoid too many return
statements within this method. Open
return name.substring(name.lastIndexOf(".") + 1);
Avoid too many return
statements within this method. Open
return null;
These nested if statements could be combined Open
if (itemOther.getClazz() == assocOther.getClazz() && item.getClazz() == assoc.getClazz()) {
add = false;
if (assocOther.name() != null && assoc.name() == null) {
if (itemOther.getType() == AssociationTypes.EDGE
&& item.getType() == AssociationTypes.ASSOCIATION) {
- 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 (subClass != null && subClass == item.getClass()) {
return item;
}
- 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.parentNode instanceof GraphModel) {
((GraphModel) this.parentNode).with(assoc);
}
- 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
}
}