File HTTPRequest.java
has 532 lines of code (exceeds 250 allowed). Consider refactoring. Open
package de.uniks.networkparser.ext.http;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
Method readHeader
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
public boolean readHeader() {
BufferedReader input = getInput();
if (input == null) {
return false;
}
- 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 parsingPath
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
private boolean parsingPath(Reader input, String defaultValue) {
this.partPath = new SimpleList<String>();
this.partParameter = new SimpleList<String>();
this.pathType = new SimpleList<Character>();
this.fullPath = new SimpleList<String>();
- 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
HTTPRequest
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
public class HTTPRequest implements Comparable<HTTPRequest> {
public static final String HTTP__NOTFOUND = "HTTP 404";
public static final String HTTP_OK = "HTTP/1.1 200 OK";
public static final String HTTP_PERMISSION_DENIED = "HTTP 403";
public static final String HTTP_CONTENT = "Content-Type:";
Method parsingPath
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
private boolean parsingPath(Reader input, String defaultValue) {
this.partPath = new SimpleList<String>();
this.partParameter = new SimpleList<String>();
this.pathType = new SimpleList<Character>();
this.fullPath = new SimpleList<String>();
Method readHeader
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
public boolean readHeader() {
BufferedReader input = getInput();
if (input == null) {
return false;
}
Method writeHeader
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public boolean writeHeader(String... header) {
PrintWriter output = getOutput();
if (output != null) {
if (this.writeHeader == false) {
output.println(HTTP_OK);
- 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 parseForm
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public SimpleKeyValueList<String, String> parseForm() {
SimpleKeyValueList<String, String> value = new SimpleKeyValueList<String, String>();
if (HTTP_CONTENT_FORM.equals(this.contentType) && this.content != null) {
CharacterBuffer buffer = new CharacterBuffer();
char c;
- 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 match
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public boolean match(HTTPRequest routing) {
this.matchOfRequestPath = 0;
this.matchValid = false;
this.matchVariables.clear();
- 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 writeBody
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public boolean writeBody(String... body) {
PrintWriter output = getOutput();
if (output != null) {
if (this.writeHeader == false) {
this.writeHeader();
- 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 close
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public boolean close() {
if (this.writeBody == false && this.bufferResponse != null) {
writeBody(this.bufferResponse.toString());
}
if (outputStream != 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 readTo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public String readTo(char splitStr) {
int c;
CharacterBuffer buffer = new CharacterBuffer();
try {
BufferedReader input = getInput();
- 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 withBufferRespone
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public HTTPRequest withBufferRespone(String... values) {
if (bufferResponse == null) {
bufferResponse = new CharacterBuffer();
}
if (values != 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 compareTo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
public int compareTo(HTTPRequest o) {
if (o == null) {
return 1;
}
- 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 0;
Avoid too many return
statements within this method. Open
return -1;
Method withHeader
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public HTTPRequest withHeader(String value) {
if (value != null) {
value = value.trim();
if (value.length() > 0) {
if (value.startsWith(HTTP_CONTENT)) {
- 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"