fujaba/NetworkParser

View on GitHub
src/main/java/de/uniks/networkparser/gui/Column.java

Summary

Maintainability
F
4 days
Test Coverage

Column has 45 methods (exceeds 20 allowed). Consider refactoring.
Open

public class Column implements SendableEntityCreatorNoIndex, CellHandler {
    public static final int AUTOWIDTH = -1;

    public static final String PROPERTY_ID = "id";

Severity: Minor
Found in src/main/java/de/uniks/networkparser/gui/Column.java - About 6 hrs to fix

    Method setValue has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

        @Override
        public boolean setValue(Object entity, String attribute, Object value, String type) {
            if (entity instanceof Column == false || attribute == null) {
                return false;
            }
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/gui/Column.java - About 4 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

    File Column.java has 356 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package de.uniks.networkparser.gui;
    
    /*
    NetworkParser
    The MIT License
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/gui/Column.java - About 4 hrs to fix

      Method setValue has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Override
          public boolean setValue(Object entity, String attribute, Object value, String type) {
              if (entity instanceof Column == false || attribute == null) {
                  return false;
              }
      Severity: Major
      Found in src/main/java/de/uniks/networkparser/gui/Column.java - About 2 hrs to fix

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

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

            @Override
            public Object getValue(Object entity, String attribute) {
                if (entity instanceof Column == false || attribute == null) {
                    return null;
                }
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/gui/Column.java - About 1 hr to fix

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

              public Object getValue(Object entity, SendableEntityCreator creator) {
                  String attrName = getAttrName();
                  if (attrName != null) {
                      if (attrName.startsWith("\"")) {
                          return attrName.substring(1, attrName.length() - 1);
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/gui/Column.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

          Avoid deeply nested control flow statements.
          Open

                                  if (oldStyle.getValue(oldStyle, prop) == null) {
                                      oldStyle.setValue(oldStyle, prop, style.getValue(style, prop), SendableEntityCreator.NEW);
                                  }
          Severity: Major
          Found in src/main/java/de/uniks/networkparser/gui/Column.java - About 45 mins to fix

            Avoid too many return statements within this method.
            Open

                        return that.getActiveStyle();
            Severity: Major
            Found in src/main/java/de/uniks/networkparser/gui/Column.java - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return that.isResizable();
              Severity: Major
              Found in src/main/java/de/uniks/networkparser/gui/Column.java - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return that.getAltAttribute();
                Severity: Major
                Found in src/main/java/de/uniks/networkparser/gui/Column.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/gui/Column.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/gui/Column.java - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return that.isMovable();
                      Severity: Major
                      Found in src/main/java/de/uniks/networkparser/gui/Column.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/gui/Column.java - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return that.getFieldTyp();
                          Severity: Major
                          Found in src/main/java/de/uniks/networkparser/gui/Column.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/gui/Column.java - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                          return that.getStyle();
                              Severity: Major
                              Found in src/main/java/de/uniks/networkparser/gui/Column.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/gui/Column.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/gui/Column.java - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                return that.getDefaultText();
                                    Severity: Major
                                    Found in src/main/java/de/uniks/networkparser/gui/Column.java - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                  return that.isVisible();
                                      Severity: Major
                                      Found in src/main/java/de/uniks/networkparser/gui/Column.java - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                    return that.isEditable();
                                        Severity: Major
                                        Found in src/main/java/de/uniks/networkparser/gui/Column.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/gui/Column.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/gui/Column.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/gui/Column.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/gui/Column.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/gui/Column.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/gui/Column.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/gui/Column.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/gui/Column.java - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                      return that.getLabel();
                                                          Severity: Major
                                                          Found in src/main/java/de/uniks/networkparser/gui/Column.java - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                        return that.getBrowserId();
                                                            Severity: Major
                                                            Found in src/main/java/de/uniks/networkparser/gui/Column.java - About 30 mins to fix

                                                              These nested if statements could be combined
                                                              Open

                                                                          if (entity != null) {
                                                                              return entity.getClass().getSimpleName();
                                                                          }

                                                              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