fujaba/NetworkParser

View on GitHub
src/main/java/de/uniks/networkparser/ext/http/HTTPRequest.java

Summary

Maintainability
F
5 days
Test Coverage

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;
Severity: Major
Found in src/main/java/de/uniks/networkparser/ext/http/HTTPRequest.java - About 1 day to fix

    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;
            }
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/ext/http/HTTPRequest.java - About 6 hrs to fix

    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>();
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/ext/http/HTTPRequest.java - About 6 hrs to fix

    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:";
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/ext/http/HTTPRequest.java - About 4 hrs to fix

      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>();
      Severity: Major
      Found in src/main/java/de/uniks/networkparser/ext/http/HTTPRequest.java - About 3 hrs to fix

        Method readHeader has 77 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public boolean readHeader() {
                BufferedReader input = getInput();
                if (input == null) {
                    return false;
                }
        Severity: Major
        Found in src/main/java/de/uniks/networkparser/ext/http/HTTPRequest.java - About 3 hrs to fix

          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);
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/ext/http/HTTPRequest.java - About 1 hr to fix

          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;
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/ext/http/HTTPRequest.java - About 1 hr to fix

          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();
          
          
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/ext/http/HTTPRequest.java - About 1 hr to fix

          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();
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/ext/http/HTTPRequest.java - About 1 hr to fix

          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) {
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/ext/http/HTTPRequest.java - About 45 mins to fix

          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();
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/ext/http/HTTPRequest.java - About 35 mins to fix

          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) {
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/ext/http/HTTPRequest.java - About 35 mins to fix

          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;
                  }
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/ext/http/HTTPRequest.java - About 35 mins to fix

          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;
          Severity: Major
          Found in src/main/java/de/uniks/networkparser/ext/http/HTTPRequest.java - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return -1;
            Severity: Major
            Found in src/main/java/de/uniks/networkparser/ext/http/HTTPRequest.java - About 30 mins to fix

              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)) {
              Severity: Minor
              Found in src/main/java/de/uniks/networkparser/ext/http/HTTPRequest.java - About 25 mins to fix

              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

              There are no issues that match your filters.

              Category
              Status