Method parsing
has a Cognitive Complexity of 171 (exceeds 5 allowed). Consider refactoring. Open
public ObjectCondition parsing(CharacterBuffer buffer, LocalisationInterface customTemplate, boolean isExpression,
boolean allowSpace, String... stopWords) {
if (buffer == 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
File Template.java
has 687 lines of code (exceeds 250 allowed). Consider refactoring. Open
package de.uniks.networkparser.parser;
/*
The MIT License
Method parsing
has 222 lines of code (exceeds 25 allowed). Consider refactoring. Open
public ObjectCondition parsing(CharacterBuffer buffer, LocalisationInterface customTemplate, boolean isExpression,
boolean allowSpace, String... stopWords) {
if (buffer == null) {
return null;
}
Method executeChildren
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
protected void executeChildren(Clazz clazz, LocalisationInterface parameters, SimpleList<Template> templates,
String id2, TemplateResultFile templateResult) {
// FIRST ATTRIBUTE
AttributeSet attributes = clazz.getAttributes();
if (attributes.size() > 0) {
- 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
Template
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
public class Template implements TemplateParser {
public static final String PROPERTY_FEATURE = "features";
public static final String TYPE_JAVA = "java";
public static final String TYPE_TYPESCRIPT = "typescript";
public static final String TYPE_CPP = "cpp";
Method executeChildren
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected void executeChildren(Clazz clazz, LocalisationInterface parameters, SimpleList<Template> templates,
String id2, TemplateResultFile templateResult) {
// FIRST ATTRIBUTE
AttributeSet attributes = clazz.getAttributes();
if (attributes.size() > 0) {
Method isValid
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected boolean isValid(TemplateItem member, LocalisationInterface parameters) {
if (member == null) {
return false;
}
if (isValid) {
- 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 generate
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public TemplateResultFragment generate(LocalisationInterface parameters, SendableEntityCreator parent,
TemplateItem member) {
ObjectCondition condition = this.token.getCondition();
if (condition instanceof StringCondition) {
this.token.withCondition(this.parsing((StringCondition) condition, parameters, false));
Method parsing
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public ObjectCondition parsing(ParserCondition... customTemplates) {
TemplateResultModel result = new TemplateResultModel();
SimpleList<ParserCondition> templateCondition = getTemplateCondition();
if (templateCondition != null) {
for (ParserCondition condition : templateCondition) {
- 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 withTemplate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public Template withTemplate(String... template) {
CharacterBuffer sb = new CharacterBuffer();
if (template == null || template.length < 1) {
setValue(sb);
return this;
- 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 (tokenPart.equalsIgnoreCase(stopword)) {
buffer.withPosition(startCommand);
if (parent.size() == 1) {
return parent.first();
}
Avoid deeply nested control flow statements. Open
if (buffer.getCurrentChar() == ' ') {
buffer.skip();
}
Avoid deeply nested control flow statements. Open
if (nextChar == ENTER) {
this.lastStopWords = stopWords;
Equals equalsExpression = new Equals();
equalsExpression.create(buffer, this, customTemplate);
equalsExpression.withLeft(child);
Avoid deeply nested control flow statements. Open
if (token.equalsIgnoreCase(stopword)) {
return parent;
}
Avoid deeply nested control flow statements. Open
if (item instanceof ParserCondition) {
condition = (ParserCondition) item;
}
Avoid deeply nested control flow statements. Open
if (assoc.getClazz().equals(assoc.getOtherClazz())
&& assoc.getName().equals(assoc.getOther().getName()) == false) {
template.executeTemplate(parameters, templateResult, assoc.getOther());
}
Method executeChildren
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
protected void executeChildren(Clazz clazz, LocalisationInterface parameters, SimpleList<Template> templates,
String id2, TemplateResultFile templateResult) {
Method parsing
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public ObjectCondition parsing(CharacterBuffer buffer, LocalisationInterface customTemplate, boolean isExpression,
boolean allowSpace, String... stopWords) {
Method executeTemplate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public void executeTemplate(LocalisationInterface parameters, TemplateResultFile templateResult,
GraphMember member) {
if (isValid(member, parameters) == false) {
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 too many return
statements within this method. Open
return StringCondition.create(buffer.substring(start, end + 1));
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return parent;
Avoid too many return
statements within this method. Open
return parent.first();
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return child;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return parent;
Method executingEntity
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private TemplateResultFragment executingEntity(ObjectCondition condition, Object parameters) {
this.isValid = true;
TemplateResultFragment templateFragment = new TemplateResultFragment();
templateFragment.withKey(this.getType());
- 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 getId
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public String getId(boolean full) {
if (full == false) {
return id;
}
if (this.owner != 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 executeClazz
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public TemplateResultFile executeClazz(Clazz clazz, LocalisationInterface parameters, boolean isStandard) {
if (isValid(clazz, parameters) == false) {
return null;
}
TemplateResultFile templateResult = createResultFile(clazz, isStandard);
- 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 (buffer.getCurrentChar() == ' ') {
buffer.skip();
}
- 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 (stopCharacter.indexOf(character) >= 0) {
break;
}
- 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
}
}