fujaba/NetworkParser

View on GitHub
src/main/java/de/uniks/networkparser/ext/javafx/ModelListenerProperty.java

Summary

Maintainability
F
3 days
Test Coverage

File ModelListenerProperty.java has 344 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package de.uniks.networkparser.ext.javafx;

/*
NetworkParser
The MIT License

    ModelListenerProperty has 28 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class ModelListenerProperty implements ModelListenerInterface, SendableEntityCreator {
        public static final String PROPERTY_MODEL = "model";
        public static final String PROPERTY_PROPERTY = "property";
        public static final String PROPERTY_VIEW = "view";
        public static final String PROPERTY_CREATOR = "creator";

      Method parseValue has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public Object parseValue(Object value) {
              if (this.type == DataType.COLOR) {
                  if (value != null && ReflectionLoader.COLOR.isAssignableFrom(value.getClass())) {
                      return value;
                  }

      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 parseValue has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public Object parseValue(Object value) {
              if (this.type == DataType.COLOR) {
                  if (value != null && ReflectionLoader.COLOR.isAssignableFrom(value.getClass())) {
                      return value;
                  }

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

            @Override
            public boolean setValue(Object entity, String attribute, Object value, String type) {
                if (entity instanceof ModelListenerProperty == false) {
                    return false;
                }

        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 setValue has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public boolean setValue(Object entity, String attribute, Object value, String type) {
                if (entity instanceof ModelListenerProperty == false) {
                    return false;
                }

          Method addPropertyChange has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public void addPropertyChange(Object item) {
                  if (item == null) {
                      return;
                  }
                  if (item instanceof SendableEntity) {

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

                public void addListener(Object listener) {
                    if(listener == null) {
                        return;
                    }
                    if (ReflectionLoader.CHANGELISTENER != null) {

            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 removeListener has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public void removeListener(Object listener) {
                    if(listener == null) {
                        return;
                    }
                    if (ReflectionLoader.CHANGELISTENER != null) {

            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;

              Avoid too many return statements within this method.
              Open

                              return value;

                Avoid too many return statements within this method.
                Open

                                return false;

                  Avoid too many return statements within this method.
                  Open

                              return Integer.valueOf("" + value);

                    Avoid too many return statements within this method.
                    Open

                                    return value;

                      Avoid too many return statements within this method.
                      Open

                                  return Boolean.valueOf("" + value);

                        Avoid too many return statements within this method.
                        Open

                                    return true;

                          Avoid too many return statements within this method.
                          Open

                                  return false;

                            Avoid too many return statements within this method.
                            Open

                                        return Double.valueOf("" + value);

                              Avoid too many return statements within this method.
                              Open

                                          return Float.valueOf("" + value);

                                Avoid too many return statements within this method.
                                Open

                                                return value;

                                  Avoid too many return statements within this method.
                                  Open

                                              return prop.getView();

                                    Avoid too many return statements within this method.
                                    Open

                                            return value;

                                      Avoid too many return statements within this method.
                                      Open

                                                      return value;

                                        Avoid too many return statements within this method.
                                        Open

                                                    return Long.valueOf("" + value);

                                          Avoid too many return statements within this method.
                                          Open

                                                      return value;

                                            Avoid too many return statements within this method.
                                            Open

                                                    return null;

                                              Avoid too many return statements within this method.
                                              Open

                                                              return value;

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

                                                    @Override
                                                    public Object getValue(Object entity, String attribute) {
                                                        if (entity instanceof ModelListenerProperty == false || attribute == null) {
                                                            return null;
                                                        }

                                                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 addPropertyChange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                    public void addPropertyChange(Object item) {
                                                        if (item == null) {
                                                            return;
                                                        }
                                                        if (item instanceof SendableEntity) {

                                                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 (ReflectionLoader.CHANGELISTENER.isAssignableFrom(listener.getClass())) {
                                                                listeners.remove(listener);
                                                            }

                                                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 (ReflectionLoader.INVALIDATIONLISTENER.isAssignableFrom(listener.getClass())) {
                                                                invalidationListeners.add(listener);
                                                            }

                                                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 (ReflectionLoader.CHANGELISTENER.isAssignableFrom(listener.getClass())) {
                                                                listeners.add(listener);
                                                            }

                                                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 (ReflectionLoader.INVALIDATIONLISTENER.isAssignableFrom(listener.getClass())) {
                                                                invalidationListeners.remove(listener);
                                                            }

                                                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