Method searching
has a Cognitive Complexity of 197 (exceeds 5 allowed). Consider refactoring. Open
public int searching(File file, PrintStream output) {
if (file == null) {
if (output != null) {
output.println("NO FILES FOUND");
}
- 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 JarValidator.java
has 600 lines of code (exceeds 250 allowed). Consider refactoring. Open
package de.uniks.networkparser.ext.generic;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
Method analyseFile
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
private boolean analyseFile(File file) {
if (file == null || file.exists() == false) {
return false;
}
JarClassLoader jarClassLoader = 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 mergePackages
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
public SimpleKeyValueList<String, JsonObject> mergePackages() {
projects.clear();
TreeSet<String> cache = new TreeSet<String>();
cache.add("de.uniks");
cache.add("de");
- 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 validate
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void validate() {
if (ReflectionBlackBoxTester.isTester()) {
return;
}
Method searching
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
public int searching(File file, PrintStream output) {
if (file == null) {
if (output != null) {
output.println("NO FILES FOUND");
}
Method analyseFile
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
private boolean analyseFile(File file) {
if (file == null || file.exists() == false) {
return false;
}
JarClassLoader jarClassLoader = null;
Method validate
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public void validate() {
if (ReflectionBlackBoxTester.isTester()) {
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
Method mergePackages
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public SimpleKeyValueList<String, JsonObject> mergePackages() {
projects.clear();
TreeSet<String> cache = new TreeSet<String>();
cache.add("de.uniks");
cache.add("de");
Method mergePacking
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public ArrayList<String> mergePacking(TreeSet<String> sources) {
ArrayList<String> dep = new ArrayList<String>();
dep.addAll(sources);
for (int i = dep.size() - 1; i > 0; i--) {
for (int z = i - 1; z >= 0; z--) {
- 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 getDependency
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private TreeSet<String> getDependency(CharacterBuffer executeProcess, String search) {
int pos = executeProcess.indexOf("##" + search + "##");
TreeSet<String> packages = new TreeSet<String>();
if (pos > 0) {
logger.print(this, "FOUND DEPENDENCY:" + search);
- 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 (pom != null) {
XMLEntity body = pom.getBody();
Entity nameTag = body.getElementBy(XMLEntity.PROPERTY_TAG, "name");
if (nameTag != null) {
if (output != null) {
Avoid deeply nested control flow statements. Open
if (output != null) {
output.print(projects.getKeyByIndex(i));
}
Method analyseReport
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public int analyseReport() {
File file = new File(rootPath + this.file);
if (file.exists()) {
CharacterBuffer content = FileBuffer.readFile(file);
String search = "<td class=\"ctr2\">";
- 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 (output != null) {
output.print(" - ");
output.print(((XMLEntity) licence
.getElementBy(XMLEntity.PROPERTY_TAG, "name")).getValue());
output.print(" - ");
- 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 (output != null) {
output.print(" - " + ((XMLEntity) nameTag).getValue());
}
- 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 (dep.get(0).equalsIgnoreCase("de") || dep.get(0).equalsIgnoreCase("de.uniks")
|| dep.get(0).equalsIgnoreCase("de.uniks.networkparser")) {
copy = 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
}
}