fujaba/NetworkParser

View on GitHub
src/main/java/de/uniks/networkparser/NetworkParserLog.java

Summary

Maintainability
B
5 hrs
Test Coverage

NetworkParserLog has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

public class NetworkParserLog extends Handler {
    public static final String ERROR_TYP_PARSING = "PARSING";
    public static final String ERROR_TYP_CONCURRENTMODIFICATION = "CONCURRENTMODIFICATION";
    public static final String ERROR_TYP_NOCREATOR = "NOCREATORFOUND";
    public static final String ERROR_TYP_DUPPLICATE = "DUPPLICATE";
Severity: Minor
Found in src/main/java/de/uniks/networkparser/NetworkParserLog.java - About 2 hrs to fix

    Method createLogger has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public static NetworkParserLog createLogger(byte flag, boolean removeConsoleHandler,
                ObjectCondition... conditions) {
            if (global != null) {
                return global;
            }
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/NetworkParserLog.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 log has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public boolean log(Object owner, String method, String msg, int level, Object... params) {
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/NetworkParserLog.java - About 35 mins to fix

      Method info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public boolean info(Object owner, String method, String message, Object... params) {
              if ((flag & LOGLEVEL_INFO) != 0) {
                  if (condition != null) {
                      Object values = params;
                      if (params != null && params.length == 1) {
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/NetworkParserLog.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 condition.update(new SimpleEvent(source, null, null, items).withType(type));
      Severity: Major
      Found in src/main/java/de/uniks/networkparser/NetworkParserLog.java - About 30 mins to fix

        Method log has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public boolean log(String type, Object... args) {
                if (type == null || condition == null || args == null) {
                    return false;
                }
                if (args.length == 1) {
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/NetworkParserLog.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

        Method publish has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            @Override
            public void publish(LogRecord record) {
                if (global != null && global != this) {
                    global.publish(record);
                    return;
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/NetworkParserLog.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

        These nested if statements could be combined
        Open

                        if (handlers[0] instanceof ConsoleHandler) {
                            rootLogger.removeHandler(handlers[0]);
                        }

        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 (condition != null) {
                        return condition
                                .update(new SimpleEvent(owner, method, null, message).withModelValue(params).withType(WARNING));
                    }

        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 (condition != null) {
                        Object values = params;
                        if (params != null && params.length == 1) {
                            values = params[0];
                        }

        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 (condition != null) {
                        return condition
                                .update(new SimpleEvent(owner, method, null, message).withModelValue(params).withType(ERROR));
                    }

        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 (condition != null) {
                        return condition
                                .update(new SimpleEvent(owner, method, null, message).withModelValue(params).withType(FATAL));
                    }

        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
         }
        }

        There are no issues that match your filters.

        Category
        Status