File GraphMatcher.java
has 700 lines of code (exceeds 250 allowed). Consider refactoring. Open
package de.uniks.networkparser.parser;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
Method matchClazzValues
has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring. Open
private boolean matchClazzValues(Clazz oldClazz, Clazz newClazz) {
if (oldClazz.getName().equals(newClazz.getName()) == false) {
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 matchClazzes
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
public boolean matchClazzes() {
if (oldModel == null || newModel == null) {
return oldModel == newModel;
}
ClazzSet oldClazzes = oldModel.getClazzes();
- 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 matchAssociations
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
private boolean matchAssociations(Clazz oldClazz, Clazz newClazz) {
AssociationSet oldAssociations = oldClazz.getAssociations();
AssociationSet newAssociations = newClazz.getAssociations();
AssociationSet oldMatches = 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 matchMethodValues
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
private boolean matchMethodValues(Method oldMethod, Method newMethod) {
if (oldMethod.getName().equals(newMethod.getName()) == false) {
return false;
}
if (oldMethod.getModifier().toString().equals(newMethod.getModifier().toString()) == 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
GraphMatcher
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
public class GraphMatcher extends GraphEntity {
private SimpleList<Match> clazzMatches = new SimpleList<Match>();
private SimpleList<Match> attributeMatches = new SimpleList<Match>();
Method matchClazzValues
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
private boolean matchClazzValues(Clazz oldClazz, Clazz newClazz) {
if (oldClazz.getName().equals(newClazz.getName()) == false) {
return false;
}
Method matchMethods
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private boolean matchMethods(Clazz oldClazz, Clazz newClazz) {
if (oldClazz == null || newClazz == null) {
return oldClazz == newClazz;
}
MethodSet oldMethods = oldClazz.getMethods();
- 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 matchAttributes
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private boolean matchAttributes(Clazz oldClazz, Clazz newClazz) {
if (oldClazz == null || newClazz == null) {
return false;
}
AttributeSet oldAttributes = oldClazz.getAttributes();
- 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 preparePotentMatches
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private SimpleKeyValueList<Double, SimpleList<Match>> preparePotentMatches(
SimpleSet<? extends GraphMember> oldMembers, SimpleSet<? extends GraphMember> newMembers,
SimpleSet<? extends GraphMember> oldMatches, SimpleSet<? extends GraphMember> newMatches) {
SimpleKeyValueList<Double, SimpleList<Match>> potentMatches = new SimpleKeyValueList<Double, SimpleList<Match>>()
.withComparator(EntityComparator.createComparator());
- 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 matchClazzes
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
public boolean matchClazzes() {
if (oldModel == null || newModel == null) {
return oldModel == newModel;
}
ClazzSet oldClazzes = oldModel.getClazzes();
Method matchAssociationValues
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private boolean matchAssociationValues(Association oldAssociation, Association newAssociation) {
if (oldAssociation == null || newAssociation == null) {
return false;
}
if (oldAssociation.getName().equals(newAssociation.getName()) == 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 matchAssociations
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
private boolean matchAssociations(Clazz oldClazz, Clazz newClazz) {
AssociationSet oldAssociations = oldClazz.getAssociations();
AssociationSet newAssociations = newClazz.getAssociations();
AssociationSet oldMatches = new AssociationSet();
Method matchMethodValues
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private boolean matchMethodValues(Method oldMethod, Method newMethod) {
if (oldMethod.getName().equals(newMethod.getName()) == false) {
return false;
}
if (oldMethod.getModifier().toString().equals(newMethod.getModifier().toString()) == false) {
Method createMatches
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public boolean createMatches() {
matchClazzes();
ClazzSet newMatches = new ClazzSet();
- 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 matchAttributes
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
private boolean matchAttributes(Clazz oldClazz, Clazz newClazz) {
if (oldClazz == null || newClazz == null) {
return false;
}
AttributeSet oldAttributes = oldClazz.getAttributes();
Method matchMethods
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
private boolean matchMethods(Clazz oldClazz, Clazz newClazz) {
if (oldClazz == null || newClazz == null) {
return oldClazz == newClazz;
}
MethodSet oldMethods = oldClazz.getMethods();
Method matchAssociationValues
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private boolean matchAssociationValues(Association oldAssociation, Association newAssociation) {
if (oldAssociation == null || newAssociation == null) {
return false;
}
if (oldAssociation.getName().equals(newAssociation.getName()) == false) {
Method preparePotentMatches
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private SimpleKeyValueList<Double, SimpleList<Match>> preparePotentMatches(
SimpleSet<? extends GraphMember> oldMembers, SimpleSet<? extends GraphMember> newMembers,
SimpleSet<? extends GraphMember> oldMatches, SimpleSet<? extends GraphMember> newMatches) {
SimpleKeyValueList<Double, SimpleList<Match>> potentMatches = new SimpleKeyValueList<Double, SimpleList<Match>>()
.withComparator(EntityComparator.createComparator());
Method prepareMatches
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private void prepareMatches(ClazzSet clazzes, boolean isFileMatch) {
for (Clazz clazz : clazzes) {
Match match = Match.createMatch(this, clazz, isFileMatch);
match.withOwner(this);
this.addClazzMatch(match);
- 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 prepareMatches
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void prepareMatches(ClazzSet clazzes, boolean isFileMatch) {
for (Clazz clazz : clazzes) {
Match match = Match.createMatch(this, clazz, isFileMatch);
match.withOwner(this);
this.addClazzMatch(match);
Method checkAssociationNames
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private boolean checkAssociationNames(Association oldAssociation, Association newAssociation, int distance,
int equals) {
if ((oldAssociation.getType() == AssociationTypes.EDGE && newAssociation.getType() != AssociationTypes.EDGE)) {
if (Double.compare(GraphUtil.compareName(oldAssociation.getName(), newAssociation.getName()),
distance) == equals) {
- 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 (oldAssociation.getClazz() == oldAssociation.getOtherClazz()
&& newAssociation.getClazz() == newAssociation.getOtherClazz()) {
matchAssociationValues(oldAssociation.getOther(), newAssociation.getOther());
}
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
FIXME found Open
//FIXME if (matchData != null) {
- Exclude checks
FIXME found Open
//FIXME if (matchData != null) {
- Exclude checks
FIXME found Open
//FIXME if (matchData != null) {
- Exclude checks
These nested if statements could be combined Open
if (matchMethodValues(oldMethod, newMethod)) {
metaMatchedMethods.add(oldMethod);
newMatchedMethods.add(newMethod);
}
- 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;
}
}
These nested if statements could be combined Open
if (matchAssociationValues(oldAssociation, newAssociation)) {
metaMatchedAssociations.add(oldAssociation);
newMatchedAssociations.add(newAssociation);
if (oldAssociation.getClazz() == oldAssociation.getOtherClazz()
- 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 (Double.compare(GraphUtil.compareName(oldAssociation.getName(), newAssociation.getName()),
distance) == equals) {
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 (Double.compare(
GraphUtil.compareName(oldAssociation.getOther().getName(), newAssociation.getOther().getName()),
distance) == equals) {
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 (matchAttributeValues(oldAttribute, newAttribute)) {
metaMatchedAttributes.add(oldAttribute);
newMatchedAttributes.add(newAttribute);
}
- 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
}
}