fujaba/NetworkParser

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

Summary

Maintainability
C
1 day
Test Coverage

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

    public static ModelListenerProperty create(Object node, SendableEntityCreator creator, Object item, String field) {
        if (node == null || ReflectionLoader.NODE == null
                || ReflectionLoader.NODE.isAssignableFrom(node.getClass()) == false) {
            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 create has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static ModelListenerProperty create(Object node, SendableEntityCreator creator, Object item, String field) {
        if (node == null || ReflectionLoader.NODE == null
                || ReflectionLoader.NODE.isAssignableFrom(node.getClass()) == false) {
            return null;
        }

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

        public static Object getProperty(Object node) {
            if(node == null) {
                return null;
            }
            if (ReflectionLoader.PROPERTY.isAssignableFrom(node.getClass())) {

    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 createProperty has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        private static ModelListenerProperty createProperty(DataType typ, Object property, SendableEntityCreator creator,
                Object item, String field) {

      Avoid too many return statements within this method.
      Open

                  return createProperty(DataType.BOOLEAN, property, creator, item, field);

        Avoid too many return statements within this method.
        Open

                return null;

          Avoid too many return statements within this method.
          Open

                      return createProperty(DataType.STRING, property, creator, item, field);

            Avoid too many return statements within this method.
            Open

                        return ReflectionLoader.call(node, "valueProperty");

              Avoid too many return statements within this method.
              Open

                          return createProperty(DataType.BOOLEAN, property, creator, item, field);

                Avoid too many return statements within this method.
                Open

                                return createProperty(DataType.DOUBLE, node, creator, item, field);

                  Avoid too many return statements within this method.
                  Open

                          return null;

                    Avoid too many return statements within this method.
                    Open

                                return createProperty(DataType.STRING, property, creator, item, field);

                      Avoid too many return statements within this method.
                      Open

                                  return ReflectionLoader.call(node, "selectedProperty");

                        Avoid too many return statements within this method.
                        Open

                                    return ReflectionLoader.call(node, "selectedProperty");

                          Avoid too many return statements within this method.
                          Open

                                      return createProperty(DataType.OBJECT, node, creator, item, field);

                            Avoid too many return statements within this method.
                            Open

                                        return createProperty(DataType.COLOR, property, creator, item, field);

                              Avoid too many return statements within this method.
                              Open

                                          return createProperty(DataType.STRING, property, creator, item, field);

                                Avoid too many return statements within this method.
                                Open

                                            return ReflectionLoader.call(node, "textProperty");

                                  There are no issues that match your filters.

                                  Category
                                  Status