File Story.java
has 482 lines of code (exceeds 250 allowed). Consider refactoring. Open
package de.uniks.networkparser.ext.story;
import java.io.PrintStream;
/*
The MIT License
Story
has 45 methods (exceeds 20 allowed). Consider refactoring. Open
public class Story extends StoryElement implements Comparable<Story> {
private String outputFile;
private SimpleList<ObjectCondition> steps = new SimpleList<ObjectCondition>();
private int counter = -1;
private boolean breakOnAssert = true;
Method writeToFile
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public boolean writeToFile(String... fileName) {
String file = null;
if(fileName == null) {
file = this.outputFile;
}else if(fileName.length>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
Method addResource
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static String addResource(HTMLEntity entity, String name, boolean include) {
name = name.replace('\\', '/');
if (name.toLowerCase().endsWith(".html") == false) {
name += ".html";
}
- 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 writeToFile
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public boolean writeToFile(String... fileName) {
String file = null;
if(fileName == null) {
file = this.outputFile;
}else if(fileName.length>0) {
Method getLabel
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public String getLabel() {
StoryStepTitle title = getTitle();
String label = null;
if(title != null) {
label = title.getTitle();
- 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 addResource
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static String addResource(HTMLEntity entity, String name, boolean include) {
name = name.replace('\\', '/');
if (name.toLowerCase().endsWith(".html") == false) {
name += ".html";
}
Method addCondition
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private boolean addCondition(StoryStepCondition step) {
if (step == null) {
return false;
}
this.add(step);
- 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 FileBuffer.writeFile(path + file, output.toString(converter)) >= 0;