fujaba/NetworkParser

View on GitHub
src/main/java/de/uniks/networkparser/ext/io/ZipContainer.java

Summary

Maintainability
C
7 hrs
Test Coverage

Method decode has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public BaseItem decode(InputStream stream) {
        if(stream == null) {
            return null;
        }
        ZipInputStream zis;
Severity: Minor
Found in src/main/java/de/uniks/networkparser/ext/io/ZipContainer.java - About 2 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 decode has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public BaseItem decode(InputStream stream) {
        if(stream == null) {
            return null;
        }
        ZipInputStream zis;
Severity: Minor
Found in src/main/java/de/uniks/networkparser/ext/io/ZipContainer.java - About 1 hr to fix

    Method getNewInstanceFromFileName has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public BaseItem getNewInstanceFromFileName(String fileName) {
            if (fileName != null) {
                int pos = fileName.lastIndexOf(".");
                String extension = "";
                if (pos >= 0) {
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/ext/io/ZipContainer.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 getFileName has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public String getFileName(BaseItem data) {
            String extension = "txt";
            String name = "data";
            if (data != null) {
                name = data.getClass().getName();
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/ext/io/ZipContainer.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 encode has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public ZipOutputStream encode(BaseItem data, OutputStream stream, boolean closeStream) {
            if (data != null) {
                ZipOutputStream zos;
                if (stream instanceof ZipOutputStream) {
                    zos = (ZipOutputStream) stream;
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/ext/io/ZipContainer.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

    Avoid too many return statements within this method.
    Open

            return null;
    Severity: Major
    Found in src/main/java/de/uniks/networkparser/ext/io/ZipContainer.java - About 30 mins to fix

      There are no issues that match your filters.

      Category
      Status