File Association.java
has 387 lines of code (exceeds 250 allowed). Consider refactoring. Open
package de.uniks.networkparser.graph;
/*
NetworkParser
The MIT License
Association
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
public class Association extends GraphMember {
public static final String PROPERTY_NODE = "node";
public static final String PROPERTY_CARDINALITY = "cardinality";
public static final String PROPERTY_PROPERTY = "property";
public static final String PROPERTY_OTHER = "other";
Method getValue
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
@Override
public Object getValue(String attribute) {
if(attribute == null) {
return null;
}
- 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 getValue
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public Object getValue(String attribute) {
if(attribute == null) {
return null;
}
Method containsAll
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected boolean containsAll(Association others, boolean both) {
if (parentNode == null) {
return false;
}
GraphSimpleSet otherChildren = others.getParents();
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
@Override
public String getName() {
if (name != null) {
return name;
}
- 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 getCardinality
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public int getCardinality() {
if (cardinality > 0) {
return cardinality;
}
if (children != null) {
- 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 contains
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected boolean contains(GraphEntity key, boolean self, boolean other) {
boolean contains = false;
if (self) {
if (parentNode == null) {
contains = 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 isSelfAssoc
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public boolean isSelfAssoc() {
GraphSimpleSet collection = getParents();
if (collection.size() > 0) {
GraphSimpleSet otherParents = getOther().getParents();
for (GraphMember parent : 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 setParentNode
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected boolean setParentNode(GraphMember value) {
/* Do Nothing */
if (value == this.parentNode) {
return 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 addIds
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected void addIds(CharacterBuffer sb) {
if (parentNode == null) {
sb.with("[]");
} else if (parentNode instanceof GraphMember) {
sb.with(((GraphMember) parentNode).getFullId());
- 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 getNodes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected SimpleSet<GraphEntity> getNodes() {
SimpleSet<GraphEntity> collection = new SimpleSet<GraphEntity>();
if (this.parentNode == 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 getInfo
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public GraphCustomItem getInfo() {
if (children == null || this.other == null || this.other.getChildren() == null) {
return null;
}
for (GraphMember child : 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
Avoid too many return
statements within this method. Open
return generate;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return AssociationTypes.isImplements(getType());
Avoid too many return
statements within this method. Open
return clazz.getValue(attribute.substring(pos + 1));
Avoid too many return
statements within this method. Open
return this.getType();
Avoid too many return
statements within this method. Open
return "<-";
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return AssociationTypes.isEdge(getType());
Avoid too many return
statements within this method. Open
return "-";
Avoid too many return
statements within this method. Open
return super.getValue(attribute);
Avoid too many return
statements within this method. Open
return this.getClazz();
Avoid too many return
statements within this method. Open
return "->";
Method getSeperator
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected String getSeperator() {
if (getType() == AssociationTypes.GENERALISATION) {
return "-^";
}
if (getOtherType() == AssociationTypes.GENERALISATION) {
- 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
These nested if statements could be combined Open
if (((GraphSimpleSet) parentNode).containsAll(otherChildren)) {
return 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 (otherParents.contains(parent)) {
return true;
}
- 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 (otherChildren.size() != 1 || parentNode != otherChildren.first()) {
return 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 (value != null) {
value.withChildren(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
}
}