fujaba/NetworkParser

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

Summary

Maintainability
F
3 wks
Test Coverage

File IdMap.java has 1422 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package de.uniks.networkparser;

import java.beans.PropertyChangeEvent;
import java.util.Collection;
import java.util.ConcurrentModificationException;
Severity: Major
Found in src/main/java/de/uniks/networkparser/IdMap.java - About 3 days to fix

    Method encode has a Cognitive Complexity of 184 (exceeds 5 allowed). Consider refactoring.
    Open

        protected Entity encode(Object entity, String className, MapEntity map, BaseItem parentNode) {
            if (map == null) {
                return null;
            }
            Grammar grammar = map.getGrammar();
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/IdMap.java - About 3 days 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 addI18N has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
    Open

        private boolean addI18N(Object root, TextItems i18n, SimpleSet<Object> items, String key, List<?> subElements) {
            if (items == null || i18n == null || items.add(root) == false) {
                return false;
            }
            SendableEntityCreator creator = this.getCreatorClass(root);
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/IdMap.java - About 1 day 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

    IdMap has 88 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class IdMap implements BaseItem, Iterable<SendableEntityCreator>, SendableEntityCreator {
        /** The Constant VALUE. */
        public static final String VALUE = "value";
    
        /** The Constant ID. */
    Severity: Major
    Found in src/main/java/de/uniks/networkparser/IdMap.java - About 1 day to fix

      Method getCloneByEntity has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
      Open

          private Object getCloneByEntity(Object reference, MapEntity map) {
              if (map == null || map.contains(reference)) {
                  return null;
              }
              SendableEntityCreator creator = getCreatorClass(reference);
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/IdMap.java - About 1 day 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 parseValue has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
      Open

          private boolean parseValue(String property, Object value, String className, SendableEntityCreator valueCreater,
                  MapEntity map, BaseItem parent) {
              if (map == null) {
                  return false;
              }
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/IdMap.java - About 1 day 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 encode has 197 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected Entity encode(Object entity, String className, MapEntity map, BaseItem parentNode) {
              if (map == null) {
                  return null;
              }
              Grammar grammar = map.getGrammar();
      Severity: Major
      Found in src/main/java/de/uniks/networkparser/IdMap.java - About 7 hrs to fix

        Method add has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
        Open

            @Override
            public boolean add(Object... values) {
                if (values == null) {
                    return false;
                }
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/IdMap.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

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

            private void countMessage(Object message, SimpleList<String> classCounts, SimpleKeyValueList<String, Object> gc) {
                if (message instanceof List<?>) {
                    for (Iterator<?> i = ((List<?>) message).iterator(); i.hasNext();) {
                        Object obj = i.next();
                        if (obj instanceof JsonObject) {
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/IdMap.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

        Method encodeList has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            protected EntityList encodeList(Object object, MapEntity map) {
                if (map == null || object == null) {
                    return null;
                }
                EntityList target = (EntityList) map.getTarget();
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/IdMap.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

        Method decode has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            public Object decode(Object value, Object target, Filter filter) {
                if (value == null) {
                    return null;
                }
                if (filter == null) {
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/IdMap.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

        Method removeObj has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

            public boolean removeObj(Object oldValue, boolean destroy) {
                String key = getKey(oldValue);
                if (destroy) {
                    SendableEntityCreator creator = getCreatorClass(oldValue);
                    if (creator != null) {
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/IdMap.java - About 3 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 getCreator has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            public SendableEntityCreator getCreator(String clazz, boolean fullName, boolean caseSensitive,
                    SimpleList<SendableEntityCreator> creators) {
                if (clazz == null || clazz.length() < 1) {
                    return null;
                }
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/IdMap.java - About 3 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 parseValue has 79 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private boolean parseValue(String property, Object value, String className, SendableEntityCreator valueCreater,
                    MapEntity map, BaseItem parent) {
                if (map == null) {
                    return false;
                }
        Severity: Major
        Found in src/main/java/de/uniks/networkparser/IdMap.java - About 3 hrs to fix

          Method addI18N has 74 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private boolean addI18N(Object root, TextItems i18n, SimpleSet<Object> items, String key, List<?> subElements) {
                  if (items == null || i18n == null || items.add(root) == false) {
                      return false;
                  }
                  SendableEntityCreator creator = this.getCreatorClass(root);
          Severity: Major
          Found in src/main/java/de/uniks/networkparser/IdMap.java - About 2 hrs to fix

            Method decode has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public Object decode(Object value, Object target, Filter filter) {
                    if (value == null) {
                        return null;
                    }
                    if (filter == null) {
            Severity: Major
            Found in src/main/java/de/uniks/networkparser/IdMap.java - About 2 hrs to fix

              Method getCloneByEntity has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private Object getCloneByEntity(Object reference, MapEntity map) {
                      if (map == null || map.contains(reference)) {
                          return null;
                      }
                      SendableEntityCreator creator = getCreatorClass(reference);
              Severity: Major
              Found in src/main/java/de/uniks/networkparser/IdMap.java - About 2 hrs to fix

                Method add has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @Override
                    public boolean add(Object... values) {
                        if (values == null) {
                            return false;
                        }
                Severity: Minor
                Found in src/main/java/de/uniks/networkparser/IdMap.java - About 1 hr to fix

                  Method encodeList has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected EntityList encodeList(Object object, MapEntity map) {
                          if (map == null || object == null) {
                              return null;
                          }
                          EntityList target = (EntityList) map.getTarget();
                  Severity: Minor
                  Found in src/main/java/de/uniks/networkparser/IdMap.java - About 1 hr to fix

                    Method getCreator has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public SendableEntityCreator getCreator(String clazz, boolean fullName, boolean caseSensitive,
                                SimpleList<SendableEntityCreator> creators) {
                            if (clazz == null || clazz.length() < 1) {
                                return null;
                            }
                    Severity: Minor
                    Found in src/main/java/de/uniks/networkparser/IdMap.java - About 1 hr to fix

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

                          public boolean replaceObject(Object newObject) {
                              String key = getKey(newObject);
                              if (key != null) {
                                  return false;
                              }
                      Severity: Minor
                      Found in src/main/java/de/uniks/networkparser/IdMap.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 checkforCreating has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private boolean checkforCreating(Object element) {
                              if (element == null) {
                                  return false;
                              }
                              if (element instanceof Entity) {
                      Severity: Minor
                      Found in src/main/java/de/uniks/networkparser/IdMap.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 withCreator has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public IdMap withCreator(SendableEntityCreator... createrClass) {
                              if (createrClass == null) {
                                  return this;
                              }
                              for (SendableEntityCreator creator : createrClass) {
                      Severity: Minor
                      Found in src/main/java/de/uniks/networkparser/IdMap.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 removeObj has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public boolean removeObj(Object oldValue, boolean destroy) {
                              String key = getKey(oldValue);
                              if (destroy) {
                                  SendableEntityCreator creator = getCreatorClass(oldValue);
                                  if (creator != null) {
                      Severity: Minor
                      Found in src/main/java/de/uniks/networkparser/IdMap.java - About 1 hr to fix

                        Method countMessage has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private void countMessage(Object message, SimpleList<String> classCounts, SimpleKeyValueList<String, Object> gc) {
                                if (message instanceof List<?>) {
                                    for (Iterator<?> i = ((List<?>) message).iterator(); i.hasNext();) {
                                        Object obj = i.next();
                                        if (obj instanceof JsonObject) {
                        Severity: Minor
                        Found in src/main/java/de/uniks/networkparser/IdMap.java - About 1 hr to fix

                          Method decodingJsonObject has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private Object decodingJsonObject(JsonObject jsonObject, MapEntity map) {
                                  if (jsonObject == null || map == null) {
                                      return null;
                                  }
                                  /* SWITCH FOR JAVAFX THREAD */
                          Severity: Minor
                          Found in src/main/java/de/uniks/networkparser/IdMap.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 replaceObject has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public boolean replaceObject(Object newObject) {
                                  String key = getKey(newObject);
                                  if (key != null) {
                                      return false;
                                  }
                          Severity: Minor
                          Found in src/main/java/de/uniks/networkparser/IdMap.java - About 1 hr to fix

                            Method put has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public boolean put(String id, Object item, boolean notification) {
                                    if (this.keyValue.add(id, item) == false) {
                                        return false;
                                    }
                                    if (this.mapListener == null) {
                            Severity: Minor
                            Found in src/main/java/de/uniks/networkparser/IdMap.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

                            Avoid deeply nested control flow statements.
                            Open

                                                    if (map.getDeep() <= ((Deep) filter).getDepth()) {
                                                        return item;
                                                    }
                            Severity: Major
                            Found in src/main/java/de/uniks/networkparser/IdMap.java - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if (parent.has(property)) {
                                                          if (isError(this, "Encode", NetworkParserLog.ERROR_TYP_DUPPLICATE, entity, className)) {
                                                              throw new RuntimeException("Property duplicate:" + property + "(" + className + ")");
                                                          }
                                                      }
                              Severity: Major
                              Found in src/main/java/de/uniks/networkparser/IdMap.java - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        if (id != null && id.equals(childEntity.getString(ID))) {
                                                            return item;
                                                        }
                                Severity: Major
                                Found in src/main/java/de/uniks/networkparser/IdMap.java - About 45 mins to fix

                                  Method parseValue has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      private boolean parseValue(String property, Object value, String className, SendableEntityCreator valueCreater,
                                              MapEntity map, BaseItem parent) {
                                  Severity: Minor
                                  Found in src/main/java/de/uniks/networkparser/IdMap.java - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            while (i.hasNext()) {
                                                                if (creator.setValue(oldValue, prop, i.next(), SendableEntityCreator.REMOVE) == false) {
                                                                    return false;
                                                                }
                                                            }
                                    Severity: Major
                                    Found in src/main/java/de/uniks/networkparser/IdMap.java - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                              if (notNull) {
                                                                  Object refValue = creator.getValue(referenceObject, property);
                                                                  encoding = value.equals(refValue) == false;
                                                              } else {
                                                                  encoding = true;
                                      Severity: Major
                                      Found in src/main/java/de/uniks/networkparser/IdMap.java - About 45 mins to fix

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

                                            private Object decodingJsonArray(JsonArray jsonArray, MapEntity map) {
                                                if (jsonArray == null || map == null) {
                                                    return null;
                                                }
                                                Object result = null;
                                        Severity: Minor
                                        Found in src/main/java/de/uniks/networkparser/IdMap.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 getValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            @Override
                                            public Object getValue(Object entity, String attribute) {
                                                SendableEntityCreator creator = getCreatorClass(entity);
                                                if (creator == null || attribute == null) {
                                                    return null;
                                        Severity: Minor
                                        Found in src/main/java/de/uniks/networkparser/IdMap.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 deeply nested control flow statements.
                                        Open

                                                                for (Object item : list) {
                                                                    Object refValue = map.getCloneByEntity(item);
                                                                    if (refValue != null) {
                                                                        creator.setValue(newObject, property, refValue, SendableEntityCreator.NEW);
                                                                    } else {
                                        Severity: Major
                                        Found in src/main/java/de/uniks/networkparser/IdMap.java - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                                  if (item instanceof Entity) {
                                                                      Entity subElement = (Entity) item;
                                                                      for (int i = 0; i < subElement.size(); i++) {
                                                                          String keyByIndex = subElement.getKeyByIndex(i);
                                                                          if (property.equalsIgnoreCase(keyByIndex)) {
                                          Severity: Major
                                          Found in src/main/java/de/uniks/networkparser/IdMap.java - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                                    if (filter.isId(value, className, this)) {
                                                                        key = tokener.getKey(value);
                                                                    }
                                            Severity: Major
                                            Found in src/main/java/de/uniks/networkparser/IdMap.java - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                                      if (value instanceof Entity) {
                                                                          if (parent instanceof EntityList) {
                                                                              parent.add(value);
                                                                              continue;
                                                                          } else if (parent instanceof Entity) {
                                              Severity: Major
                                              Found in src/main/java/de/uniks/networkparser/IdMap.java - About 45 mins to fix

                                                Avoid deeply nested control flow statements.
                                                Open

                                                                        if (valueCreater != null && targetList != null) {
                                                                            if (convert > 0 && contains == false) {
                                                                                encode(value, className, map, item);
                                                                            }
                                                                            Entity child = tokener.createLink(item, fullProp, className, tokener.getId(value));
                                                Severity: Major
                                                Found in src/main/java/de/uniks/networkparser/IdMap.java - About 45 mins to fix

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                                          if (key != null) {
                                                                              contains = map.contains(key);
                                                                          }
                                                  Severity: Major
                                                  Found in src/main/java/de/uniks/networkparser/IdMap.java - About 45 mins to fix

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

                                                        public boolean isError(Object owner, String method, String type, Object entity, String className) {
                                                    Severity: Minor
                                                    Found in src/main/java/de/uniks/networkparser/IdMap.java - About 35 mins to fix

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

                                                          private boolean addI18N(Object root, TextItems i18n, SimpleSet<Object> items, String key, List<?> subElements) {
                                                      Severity: Minor
                                                      Found in src/main/java/de/uniks/networkparser/IdMap.java - About 35 mins to fix

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

                                                            public SimpleList<Object> getTypList(SendableEntityCreator creator) {
                                                                if (creator == null) {
                                                                    return null;
                                                                }
                                                                SimpleList<Object> result = new SimpleList<Object>();
                                                        Severity: Minor
                                                        Found in src/main/java/de/uniks/networkparser/IdMap.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

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

                                                            @Override
                                                            public boolean setValue(Object entity, String attribute, Object value, String type) {
                                                                SendableEntityCreator creator = getCreatorClass(entity);
                                                                if (creator == null || attribute == null) {
                                                                    return false;
                                                        Severity: Minor
                                                        Found in src/main/java/de/uniks/networkparser/IdMap.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 null;
                                                        Severity: Major
                                                        Found in src/main/java/de/uniks/networkparser/IdMap.java - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                  return decoding(valueItem, map);
                                                          Severity: Major
                                                          Found in src/main/java/de/uniks/networkparser/IdMap.java - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                            return decodingXMLEntity(tokener, buffer, map);
                                                            Severity: Major
                                                            Found in src/main/java/de/uniks/networkparser/IdMap.java - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

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

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                            return decode(item);
                                                                Severity: Major
                                                                Found in src/main/java/de/uniks/networkparser/IdMap.java - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                                              return mf.getValue(entity);
                                                                  Severity: Major
                                                                  Found in src/main/java/de/uniks/networkparser/IdMap.java - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                                    return byteTokener.decodeValue((byte) firstChar, buffer, map);
                                                                    Severity: Major
                                                                    Found in src/main/java/de/uniks/networkparser/IdMap.java - About 30 mins to fix

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                              return jsonTokener.decoding(jsonObject, map, false);
                                                                      Severity: Major
                                                                      Found in src/main/java/de/uniks/networkparser/IdMap.java - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                                    return item;
                                                                        Severity: Major
                                                                        Found in src/main/java/de/uniks/networkparser/IdMap.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/IdMap.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/IdMap.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/IdMap.java - About 30 mins to fix

                                                                                Avoid too many return statements within this method.
                                                                                Open

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

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

                                                                                      protected String getId(SendableEntityCreator creator, MapEntity map, Object entity, String className) {
                                                                                          String id = null;
                                                                                          Object temp = null;
                                                                                          if (creator instanceof SendableEntityCreatorIndexId) {
                                                                                              temp = creator.getValue(entity, IdMap.ID);
                                                                                  Severity: Minor
                                                                                  Found in src/main/java/de/uniks/networkparser/IdMap.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 (item.getClass().getName().equals(clazzName)) {
                                                                                                      result.add(item);
                                                                                                  }

                                                                                  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 (map.getDeep() <= ((Deep) filter).getDepth()) {
                                                                                                              return item;
                                                                                                          }

                                                                                  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 (clazzName.startsWith(firstLetter)) {
                                                                                                      creators.add(this.creators.getValueByIndex(i));
                                                                                                  }

                                                                                  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 instanceof SendableEntityCreator) {
                                                                                                      /* SIMPLE CASE */
                                                                                                      element = i18n.getLabelValue(fullKey + ":autocreate");
                                                                                                      boolean creating;
                                                                                                      if (element instanceof Boolean) {

                                                                                  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 (jsonObject.has(IdMap.ID) == false && jsonObject.has(IdMap.CLASS) == false) {
                                                                                                  /* It is a SimpleFormat */
                                                                                                  Object target = map.getTarget();
                                                                                                  SendableEntityCreator creator = this.getCreatorClass(target);
                                                                                                  return jsonTokener.decodingSimple(jsonObject, target, creator);

                                                                                  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 (filter.convert(item, null, entity, this, map.getDeep()) < 0) {
                                                                                                          ObjectCondition propertyRegard = map.getFilter().getPropertyRegard();
                                                                                                          if (propertyRegard instanceof MapFilter) {
                                                                                                              MapFilter mf = (MapFilter) propertyRegard;
                                                                                                              return mf.getValue(entity);

                                                                                  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 (isError(this, "Encode", NetworkParserLog.ERROR_TYP_DUPPLICATE, entity, className)) {
                                                                                                                  throw new RuntimeException("Property duplicate:" + property + "(" + className + ")");
                                                                                                              }

                                                                                  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