Method update
has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring. Open
@Override
public boolean update(Object evt) {
if (evt == null) {
return value == 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 update
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public boolean update(Object evt) {
if (evt == null) {
return value == null;
}
Method getValue
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
private Object getValue(ObjectCondition condition, Object evt) {
if (evt instanceof LocalisationInterface) {
LocalisationInterface li = (LocalisationInterface) evt;
if (condition instanceof ParserCondition) {
return ((ParserCondition) condition).getValue(li);
- 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 Equals.java
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
package de.uniks.networkparser.logic;
import java.beans.PropertyChangeEvent;
import java.util.Set;
Equals
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
public class Equals implements ParserCondition, SendableEntityCreator {
/** Constant of KEY. */
public static final String PROPERTY_KEY = "key";
/** Constant of StrValue. */
Method getValue
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private Object getValue(ObjectCondition condition, Object evt) {
if (evt instanceof LocalisationInterface) {
LocalisationInterface li = (LocalisationInterface) evt;
if (condition instanceof ParserCondition) {
return ((ParserCondition) condition).getValue(li);
Method create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void create(CharacterBuffer buffer, TemplateParser parser, LocalisationInterface customTemplate) {
/* CHECK IF CURRENT = */
if(buffer == null || parser == null) {
return;
- 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 (position > 0) {
return rightNumber > leftNumber;
}
Avoid too many return
statements within this method. Open
return value.equals(evt);
Avoid too many return
statements within this method. Open
return event.getPropertyName().equals(value);
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return leftValue.equals(rightValue);
Avoid too many return
statements within this method. Open
return ((AssociationTypes) leftValue).IsSame(rightValue);
Avoid too many return
statements within this method. Open
return ((AssociationTypes) rightValue).IsSame(rightValue);
Avoid too many return
statements within this method. Open
return evt == null;
Avoid too many return
statements within this method. Open
return ((expValue - deltaValue) <= evtValue && (expValue + deltaValue) >= evtValue);
Avoid too many return
statements within this method. Open
return expValue.equals(evtValue);
Avoid too many return
statements within this method. Open
return value == evt;
Avoid too many return
statements within this method. Open
return ((ParserCondition) condition).getValue(li);
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return ((String) leftValue).equalsIgnoreCase((String) rightValue);
Avoid too many return
statements within this method. Open
return this.value.equals(item);
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return value.equals(this.value);
Avoid too many return
statements within this method. Open
return buffer.byteAt(pos) == btrValue;
Avoid too many return
statements within this method. Open
return oc.update(event);
Avoid too many return
statements within this method. Open
return ((expValue - deltaValue) <= evtValue && (expValue + deltaValue) >= evtValue);
Avoid too many return
statements within this method. Open
return false;
Method getValue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public Object getValue(LocalisationInterface value) {
if (value instanceof SendableEntityCreator) {
SendableEntityCreator variables = (SendableEntityCreator) value;
Object object = variables.getValue(variables, this.key);
- 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 (leftValue instanceof Number || EntityUtil.isNumeric("" + leftValue)) {
if (rightValue instanceof Number || EntityUtil.isNumeric("" + rightValue)) {
Double leftNumber = Double.valueOf("" + leftValue);
Double rightNumber = Double.valueOf("" + rightValue);
if (position > 0) {
- 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 (rightValue instanceof Number || EntityUtil.isNumeric("" + rightValue)) {
Double leftNumber = Double.valueOf("" + leftValue);
Double rightNumber = Double.valueOf("" + rightValue);
if (position > 0) {
return rightNumber > leftNumber;
- 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
}
}