Method calculateModelDiffs
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected boolean calculateModelDiffs(GraphModel model, GraphMatcher matches, Match match) {
Clazz oldClazz = (Clazz) match.getOtherMatch().getMatch();
Clazz newClazz = (Clazz) match.getMatch();
- 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 calculateFileDiffs
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected boolean calculateFileDiffs(GraphModel model, GraphMatcher matches, Match match) {
Clazz oldClazz = (Clazz) match.getMatch();
Clazz newClazz = (Clazz) match.getOtherMatch().getMatch();
- 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 calculateModelDiffs
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
protected boolean calculateModelDiffs(GraphModel model, GraphMatcher matches, Match match) {
Clazz oldClazz = (Clazz) match.getOtherMatch().getMatch();
Clazz newClazz = (Clazz) match.getMatch();
Method calculateFileDiffs
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
protected boolean calculateFileDiffs(GraphModel model, GraphMatcher matches, Match match) {
Clazz oldClazz = (Clazz) match.getMatch();
Clazz newClazz = (Clazz) match.getOtherMatch().getMatch();
Avoid deeply nested control flow statements. Open
if (superMatch.isMetaMatch() == false && superMatch.isSourceMatch() == false) {
continue;
}
Avoid deeply nested control flow statements. Open
if (superMatch.getSourceMatch() == oldSuperClazz == false) {
continue;
}
Avoid deeply nested control flow statements. Open
if (superMatch.isMetaMatch() == false) {
continue;
}
Avoid deeply nested control flow statements. Open
if (superMatch.isMetaMatch() == false) {
continue;
}
Avoid deeply nested control flow statements. Open
if (superMatch.isMetaMatch() == false && superMatch.isSourceMatch() == false) {
continue;
}
Avoid deeply nested control flow statements. Open
if (superMatch.getSourceMatch() == newSuperClazz == false) {
continue;
}
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;
}
}
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;
}
}