fujaba/NetworkParser

View on GitHub
src/main/java/de/uniks/networkparser/graph/GraphMember.java

Summary

Maintainability
F
4 days
Test Coverage

Method getValue has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
Open

    public Object getValue(String attribute) {
        if (attribute == null) {
            return null;
        }
        if (PROPERTY_PATH.equalsIgnoreCase(attribute)) {
Severity: Minor
Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 1 day 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

File GraphMember.java has 388 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package de.uniks.networkparser.graph;

import java.util.Collection;

import de.uniks.networkparser.buffer.CharacterBuffer;
Severity: Minor
Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 5 hrs to fix

    Method getValue has 110 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public Object getValue(String attribute) {
            if (attribute == null) {
                return null;
            }
            if (PROPERTY_PATH.equalsIgnoreCase(attribute)) {
    Severity: Major
    Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 4 hrs to fix

      Method withAnnotation has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          protected GraphMember withAnnotation(Annotation value) {
              /* Remove Old GraphAnnotation */
              if (this.children != null) {
                  if (this.children instanceof GraphMember) {
                      if (this.children instanceof Annotation) {
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/graph/GraphMember.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 withChildren has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          GraphMember withChildren(GraphMember... values) {
              /* Do Nothing */
              if (values == null || (values.length == 1 && (this.children == values[0]))) {
                  return this;
              }
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/graph/GraphMember.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 remove has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          public boolean remove(GraphMember member) {
              if (member == null) {
                  return true;
              }
              if (this.children instanceof GraphSimpleSet) {
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/graph/GraphMember.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 withModifier has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          protected GraphMember withModifier(Modifier... values) {
              if (values == null) {
                  return this;
              }
              Modifier rootModifier = getModifier();
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/graph/GraphMember.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 withChildren has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          GraphMember withChildren(GraphMember... values) {
              /* Do Nothing */
              if (values == null || (values.length == 1 && (this.children == values[0]))) {
                  return this;
              }
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 1 hr to fix

        Method getAnnotation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            protected Annotation getAnnotation() {
                if (this.children == null) {
                    return null;
                }
                if (this.children instanceof Annotation) {
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/graph/GraphMember.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 deeply nested control flow statements.
        Open

                                if (oldValue != null) {
                                    oldValue.setParentNode(null);
                                }
        Severity: Major
        Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 45 mins to fix

          Method getNodes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              protected SimpleSet<GraphEntity> getNodes() {
                  SimpleSet<GraphEntity> collection = new SimpleSet<GraphEntity>();
                  if (this.children == null) {
                      return collection;
                  }
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/graph/GraphMember.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 getModifier has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public Modifier getModifier() {
                  if (this.children == null) {
                      return null;
                  }
                  if (this.children instanceof Modifier) {
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/graph/GraphMember.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 getValue(PROPERTY_PARENT);
          Severity: Major
          Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                return item.getValue(attribute.substring(pos + 1));
            Severity: Major
            Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return this.name;
              Severity: Major
              Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return children.getValue(attribute.substring(pos + 1));
                Severity: Major
                Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return "";
                  Severity: Major
                  Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

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

                      Avoid too many return statements within this method.
                      Open

                                      return item.getValue(attribute.substring(pos + 1));
                      Severity: Major
                      Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return annotation;
                        Severity: Major
                        Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return buffer.toString();
                          Severity: Major
                          Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return this.getClass().getName();
                            Severity: Major
                            Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                          return literals;
                              Severity: Major
                              Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

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

                                  Avoid too many return statements within this method.
                                  Open

                                              return children;
                                  Severity: Major
                                  Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                return this.parentNode;
                                    Severity: Major
                                    Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                  return getClass().getSimpleName().toLowerCase();
                                      Severity: Major
                                      Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                    return this.children;
                                        Severity: Major
                                        Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                          return literals.getValue(attribute.substring(pos + 1));
                                          Severity: Major
                                          Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                        return PROPERTY_THIS;
                                            Severity: Major
                                            Found in src/main/java/de/uniks/networkparser/graph/GraphMember.java - About 30 mins to fix

                                              These nested if statements could be combined
                                              Open

                                                              if (this.children instanceof Annotation) {
                                                                  ((Annotation) this.children).setParentNode(null);
                                                                  this.children = null;
                                                              }

                                              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 (list.add(value)) {
                                                                  value.setParentNode(this);
                                                              }

                                              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 (values.length == 1) {
                                                              this.children = values[0];
                                                              ((GraphMember) values[0]).setParentNode(this);
                                                              return this;
                                                          }

                                              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