fujaba/NetworkParser

View on GitHub
src/main/java/de/uniks/networkparser/UpdateListener.java

Summary

Maintainability
F
4 days
Test Coverage

Method execute has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    public Object execute(Entity updateMessage, Filter filter) {
        if (updateMessage.has(SendableEntityCreator.UPDATE) == false && updateMessage.has(SendableEntityCreator.REMOVE) == false) {
            return null;
        }
        if (this.map == null) {
Severity: Minor
Found in src/main/java/de/uniks/networkparser/UpdateListener.java - About 6 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 change has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

    public boolean change(String property, SendableEntityCreator creator, Entity change, Object oldValue,
            Object newValue) {
        boolean done = false;
        if (creator == null) {
            return false;
Severity: Minor
Found in src/main/java/de/uniks/networkparser/UpdateListener.java - About 5 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 UpdateListener.java has 380 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package de.uniks.networkparser;

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

    Method change has 81 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public boolean change(String property, SendableEntityCreator creator, Entity change, Object oldValue,
                Object newValue) {
            boolean done = false;
            if (creator == null) {
                return false;
    Severity: Major
    Found in src/main/java/de/uniks/networkparser/UpdateListener.java - About 3 hrs to fix

      Method execute has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public Object execute(Entity updateMessage, Filter filter) {
              if (updateMessage.has(SendableEntityCreator.UPDATE) == false && updateMessage.has(SendableEntityCreator.REMOVE) == false) {
                  return null;
              }
              if (this.map == null) {
      Severity: Major
      Found in src/main/java/de/uniks/networkparser/UpdateListener.java - About 3 hrs to fix

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

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                if (evt == null) {
                    return;
                }
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/UpdateListener.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 propertyChange has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                if (evt == null) {
                    return;
                }
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/UpdateListener.java - About 1 hr to fix

          Method executePatch has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public Object executePatch(String op, String path, Entity updateMessage) {
                  if (root == null || path == null) {
                      return null;
                  }
                  if (root instanceof Entity) {
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/UpdateListener.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 setValue has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              private Object setValue(SendableEntityCreator creator, Object element, String key, Object newValue, String typ) {
                  if (newValue instanceof Entity) {
                      Entity json = (Entity) newValue;
                      Object value = this.map.decode(json);
                      if (value != null) {
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/UpdateListener.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 update has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public boolean update(Object value) {
                  if (value instanceof SimpleEvent == false || condition == null) {
                      return false;
                  }
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/UpdateListener.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 change has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public Entity change(String property, Object source, SendableEntityCreator creatorClass, Object oldValue,
                      Object newValue) {
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/UpdateListener.java - About 35 mins to fix

            Method setValue has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                private Object setValue(SendableEntityCreator creator, Object element, String key, Object newValue, String typ) {
            Severity: Minor
            Found in src/main/java/de/uniks/networkparser/UpdateListener.java - About 35 mins to fix

              Method change has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public boolean change(String property, SendableEntityCreator creator, Entity change, Object oldValue,
                          Object newValue) {
              Severity: Minor
              Found in src/main/java/de/uniks/networkparser/UpdateListener.java - About 35 mins to fix

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

                    private Entity getElement(String path, Entity element, Entity parent) {
                        if (path == null) {
                            return null;
                        }
                        int pos = path.indexOf("/");
                Severity: Minor
                Found in src/main/java/de/uniks/networkparser/UpdateListener.java - About 35 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 true;
                Severity: Major
                Found in src/main/java/de/uniks/networkparser/UpdateListener.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/UpdateListener.java - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                        return setValue(creator, masterObj, key, update.getValue(key), SendableEntityCreator.NEW);
                    Severity: Major
                    Found in src/main/java/de/uniks/networkparser/UpdateListener.java - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                          return setValue(creator, masterObj, key, item.getValue(), SendableEntityCreator.NEW);
                      Severity: Major
                      Found in src/main/java/de/uniks/networkparser/UpdateListener.java - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

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

                          Avoid too many return statements within this method.
                          Open

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

                            Avoid too many return statements within this method.
                            Open

                                                return setValue(creator, masterObj, key, item.getValue(), SendableEntityCreator.NEW);
                            Severity: Major
                            Found in src/main/java/de/uniks/networkparser/UpdateListener.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/UpdateListener.java - About 30 mins to fix

                                There are no issues that match your filters.

                                Category
                                Status