fujaba/NetworkParser

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

Summary

Maintainability
F
3 days
Test Coverage

File Association.java has 387 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package de.uniks.networkparser.graph;

/*
NetworkParser
The MIT License
Severity: Minor
Found in src/main/java/de/uniks/networkparser/graph/Association.java - About 5 hrs to fix

    Association has 31 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class Association extends GraphMember {
        public static final String PROPERTY_NODE = "node";
        public static final String PROPERTY_CARDINALITY = "cardinality";
        public static final String PROPERTY_PROPERTY = "property";
        public static final String PROPERTY_OTHER = "other";
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/graph/Association.java - About 3 hrs to fix

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

          @Override
          public Object getValue(String attribute) {
              if(attribute == null) {
                  return null;
              }
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/graph/Association.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 getValue has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Override
          public Object getValue(String attribute) {
              if(attribute == null) {
                  return null;
              }
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/graph/Association.java - About 1 hr to fix

        Method containsAll has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            protected boolean containsAll(Association others, boolean both) {
                if (parentNode == null) {
                    return false;
                }
                GraphSimpleSet otherChildren = others.getParents();
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/graph/Association.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 getName has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            @Override
            public String getName() {
                if (name != null) {
                    return name;
                }
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/graph/Association.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 getCardinality has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public int getCardinality() {
                if (cardinality > 0) {
                    return cardinality;
                }
                if (children != null) {
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/graph/Association.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 contains has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            protected boolean contains(GraphEntity key, boolean self, boolean other) {
                boolean contains = false;
                if (self) {
                    if (parentNode == null) {
                        contains = false;
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/graph/Association.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 isSelfAssoc has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public boolean isSelfAssoc() {
                GraphSimpleSet collection = getParents();
                if (collection.size() > 0) {
                    GraphSimpleSet otherParents = getOther().getParents();
                    for (GraphMember parent : collection) {
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/graph/Association.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 setParentNode has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            @Override
            protected boolean setParentNode(GraphMember value) {
                /* Do Nothing */
                if (value == this.parentNode) {
                    return false;
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/graph/Association.java - About 55 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 addIds has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            protected void addIds(CharacterBuffer sb) {
                if (parentNode == null) {
                    sb.with("[]");
                } else if (parentNode instanceof GraphMember) {
                    sb.with(((GraphMember) parentNode).getFullId());
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/graph/Association.java - About 55 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 getNodes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

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

            public GraphCustomItem getInfo() {
                if (children == null || this.other == null || this.other.getChildren() == null) {
                    return null;
                }
                for (GraphMember child : getChildren()) {
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/graph/Association.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 generate;
        Severity: Major
        Found in src/main/java/de/uniks/networkparser/graph/Association.java - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

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

            Avoid too many return statements within this method.
            Open

                        return AssociationTypes.isImplements(getType());
            Severity: Major
            Found in src/main/java/de/uniks/networkparser/graph/Association.java - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

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

                Avoid too many return statements within this method.
                Open

                            return this.getType();
                Severity: Major
                Found in src/main/java/de/uniks/networkparser/graph/Association.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/Association.java - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

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

                      Avoid too many return statements within this method.
                      Open

                                  return AssociationTypes.isEdge(getType());
                      Severity: Major
                      Found in src/main/java/de/uniks/networkparser/graph/Association.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/Association.java - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                  return super.getValue(attribute);
                          Severity: Major
                          Found in src/main/java/de/uniks/networkparser/graph/Association.java - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return this.getClazz();
                            Severity: Major
                            Found in src/main/java/de/uniks/networkparser/graph/Association.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/Association.java - About 30 mins to fix

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

                                    protected String getSeperator() {
                                        if (getType() == AssociationTypes.GENERALISATION) {
                                            return "-^";
                                        }
                                        if (getOtherType() == AssociationTypes.GENERALISATION) {
                                Severity: Minor
                                Found in src/main/java/de/uniks/networkparser/graph/Association.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 (((GraphSimpleSet) parentNode).containsAll(otherChildren)) {
                                                return false;
                                            }

                                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 (otherParents.contains(parent)) {
                                                        return true;
                                                    }

                                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 (otherChildren.size() != 1 || parentNode != otherChildren.first()) {
                                                return false;
                                            }

                                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 (value != null) {
                                                value.withChildren(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