zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.java

Summary

Maintainability
F
1 wk
Test Coverage

File TrackerImpl.java has 749 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* TrackerImpl.java

    Purpose:
        
    Description:
Severity: Major
Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.java - About 1 day to fix

    Method tieValue has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring.
    Open

        public void tieValue(Object comp, Object base, Object script, Object propName, Object value, Object basePath) {
            if (value instanceof IndirectBinding) {
                value = ((IndirectBinding) value).getValue(null);
            }
            if (base == null) { //track from component
    Severity: Minor
    Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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

    TrackerImpl has 48 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class TrackerImpl implements Tracker, Serializable {
        private static final long serialVersionUID = 1463169907348730644L;
        protected Map<Component, Map<Object, TrackerNode>> _compMap; //comp -> path -> head TrackerNode
        protected Map<Object, Set<TrackerNode>> _nullMap = new LinkedHashMap<Object, Set<TrackerNode>>(); //property -> Set of head TrackerNode that eval to null
        protected transient Map<Object, Set<TrackerNode>> _beanMap = new WeakIdentityMap<Object, Set<TrackerNode>>(); //bean -> Set of TrackerNode
    Severity: Minor
    Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.java - About 6 hrs to fix

      Method getLoadBindingsPerProperty has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
      Open

          private void getLoadBindingsPerProperty(Collection<TrackerNode> nodes, String prop,
                  LinkedHashSet<LoadBinding> bindings, LinkedHashSet<Object> kidbases, Set<TrackerNode> visited) {
              if (".".equals(prop)) { //all base object
                  for (TrackerNode node : nodes) {
                      getLoadBindings0(node, bindings, kidbases, visited);
      Severity: Minor
      Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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 tieValue has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public void tieValue(Object comp, Object base, Object script, Object propName, Object value, Object basePath) {
              if (value instanceof IndirectBinding) {
                  value = ((IndirectBinding) value).getValue(null);
              }
              if (base == null) { //track from component
      Severity: Major
      Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.java - About 2 hrs to fix

        Method getOrCreateTrackerNode has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            protected TrackerNode getOrCreateTrackerNode(Component comp, String[] series) {
                Map<Object, TrackerNode> nodes = _compMap.get(comp);
        
                TrackerNode parentNode = null;
                for (String script : series) {
        Severity: Minor
        Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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 remove has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

                public void remove(Object bean) {
                    EqualBeans equalBeans = _innerMap.remove(bean);
                    if (equalBeans != null) {
                        _identityMap.remove(bean);
                        removeFromEqualBeansAndReput(equalBeans, bean);
        Severity: Minor
        Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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 collectLoadBindings has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            private void collectLoadBindings(Object base, String prop, LinkedHashSet<LoadBinding> bindings,
                    Set<TrackerNode> visited) {
                final LinkedHashSet<Object> kidbases = new LinkedHashSet<Object>(); //collect kid as base bean
                if (base != null) {
                    final Set<TrackerNode> nodes = getAllTrackerNodesByBean(base);
        Severity: Minor
        Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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 getLoadBindingsPerProperty has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private void getLoadBindingsPerProperty(Collection<TrackerNode> nodes, String prop,
                    LinkedHashSet<LoadBinding> bindings, LinkedHashSet<Object> kidbases, Set<TrackerNode> visited) {
                if (".".equals(prop)) { //all base object
                    for (TrackerNode node : nodes) {
                        getLoadBindings0(node, bindings, kidbases, visited);
        Severity: Minor
        Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.java - About 1 hr to fix

          Method getEqualBeans has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

                  public Set<Object> getEqualBeans(Object bean) {
                      boolean doSync = false;
                      EqualBeans equalBeans;
                      if (bean instanceof Collection) {
                          equalBeans = _identityMap.get(bean);
          Severity: Minor
          Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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 dumpBeanMap has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              private void dumpBeanMap(boolean dumpNodes) {
                  System.out.println("******* _beanMap: *********");
                  System.out.println("******* size: " + _beanMap.size());
                  for (Object bean : _beanMap.keySet()) {
                      System.out.println("bean:" + bean + "------------");
          Severity: Minor
          Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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 getLoadBindings0 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              private void getLoadBindings0(TrackerNode node, LinkedHashSet<LoadBinding> bindings, Set<Object> kidbases,
                      Set<TrackerNode> visited) {
                  if (visited.contains(node)) { //already visited
                      return;
                  }
          Severity: Minor
          Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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 remove has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                  public Object remove(Object value) {
                      _beanSet.remove(value);
                      if (_beanSet.isEmpty()) {
                          _beanSet = null;
                      } else if (System.identityHashCode(_proxy.get()) == System.identityHashCode(value)) {
          Severity: Minor
          Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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 getEqualBeans has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public Set<Object> getEqualBeans(Object bean) {
                      boolean doSync = false;
                      EqualBeans equalBeans;
                      if (bean instanceof Collection) {
                          equalBeans = _identityMap.get(bean);
          Severity: Minor
          Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.java - About 1 hr to fix

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

                protected void addBeanMap(TrackerNode node, Object value, Object basePath) {
                    //add node into _beanMap
                    if (!testEqualsBean(node.getBean(), value)) {
                        //try to remove from the _beanMap
                        removeBeanMap(node);
            Severity: Minor
            Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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

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

                    public void put(Object bean) {
                        EqualBeans equalBeans = _innerMap.get(bean);
                        if (equalBeans == null) { //hashcode might changed
                            equalBeans = _identityMap.remove(bean);
                            if (equalBeans != null) { //hashcode is changed
            Severity: Minor
            Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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 testBindingRendererCase has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                private boolean testBindingRendererCase(LoadBinding binding) {
                    if (binding instanceof LoadChildrenBinding)
                        return true;
                    if (binding instanceof LoadPropertyBinding) {
                        LoadPropertyBinding lb = (LoadPropertyBinding) binding;
            Severity: Minor
            Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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

                                        if (refBinding.getComponent() == comp) {
                                            ignore = false;
                                            break;
                                        }
            Severity: Major
            Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.java - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if (!baseNode.isPropNameNodeMapped(node)) {
                                              baseNode.tieProperty(propName, node);
                                              propNodes.add(node);
                                          } else {
                                              // ZK-5043, tie property if the propName is text, not variable
              Severity: Major
              Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.java - About 45 mins to fix

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

                    public void tieValue(Object comp, Object base, Object script, Object propName, Object value, Object basePath) {
                Severity: Minor
                Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.java - About 45 mins to fix

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

                      private void getLoadBindingsPerProperty(Collection<TrackerNode> nodes, String prop,
                              LinkedHashSet<LoadBinding> bindings, LinkedHashSet<Object> kidbases, Set<TrackerNode> visited) {
                  Severity: Minor
                  Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.java - About 35 mins to fix

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

                        public void addDependsOn(Component srcComp, String[] srcSeries, Binding srcBinding, Component dependsOnComp,
                                String[] dependsOnSeries) {
                    Severity: Minor
                    Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.java - About 35 mins to fix

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

                          private Set<TrackerNode> getDependents(Set<TrackerNode> parentnodes, String prop) {
                              final Set<TrackerNode> kidnodes = new LinkedHashSet<TrackerNode>();
                              for (TrackerNode node : parentnodes) {
                                  for (TrackerNode kid : node.getDependents(prop)) {
                                      if (kid != null) {
                      Severity: Minor
                      Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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 removeTrackings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public void removeTrackings(Set<Component> comps) {
                              final Set<TrackerNode> removed = new LinkedHashSet<TrackerNode>();
                              for (Component comp : comps) {
                                  final Map<Object, TrackerNode> nodesMap = _compMap.remove(comp);
                                  if (nodesMap != null) {
                      Severity: Minor
                      Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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 getAllTrackerNodes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected Collection<TrackerNode> getAllTrackerNodes() {
                              Set<TrackerNode> all = null;
                              final Collection<Map<Object, TrackerNode>> nodesMaps = _compMap.values();
                              if (nodesMaps != null && !nodesMaps.isEmpty()) {
                                  all = new LinkedHashSet<TrackerNode>();
                      Severity: Minor
                      Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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 getNodesLoadBindings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private void getNodesLoadBindings(Set<TrackerNode> basenodes, LinkedHashSet<LoadBinding> bindings,
                                  LinkedHashSet<Object> kidbases, Set<TrackerNode> visited) {
                              if (basenodes != null) {
                                  for (TrackerNode node : basenodes) {
                                      if (node != null) {
                      Severity: Minor
                      Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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

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

                          private void dumpCompMap(boolean dumpNodes) {
                              System.out.println("******* _compMap: *********");
                              System.out.println("******* size: " + _compMap.size());
                              for (Component comp : _compMap.keySet()) {
                                  System.out.println("comp:" + comp + "------------");
                      Severity: Minor
                      Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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

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

                          private void dumpNullMap(boolean dumpNodes) {
                              System.out.println("******* _nullMap: *********");
                              System.out.println("******* size: " + _nullMap.size());
                              for (Object field : _nullMap.keySet()) {
                                  System.out.println("field:" + field + "------");
                      Severity: Minor
                      Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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

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

                          protected void removeBeanMap(TrackerNode node) {
                              final Object value = node.getBean();
                              if (value != null) {
                                  node.setBean(null);
                                  final Set<TrackerNode> nodes = _beanMap.get(value);
                      Severity: Minor
                      Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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

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

                              private void syncInnerMap(EqualBeans equalBeans, Object bean) {
                                  //hashCode of bean has changed, must reset
                                  boolean found = false;
                                  final WeakHashMap<Object, EqualBeans> newMap = new WeakHashMap<Object, EqualBeans>(_innerMap.size());
                                  //ZK-781. Copy one by one to reset _innerMap
                      Severity: Minor
                      Found in zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.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

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                                  for (Iterator<Entry<Object, EqualBeans>> it = _innerMap.entrySet().iterator(); it.hasNext();) {
                                      final Entry<Object, EqualBeans> entry = it.next();
                                      final EqualBeans beans = entry.getValue();
                                      if (equalBeans.equals(beans)) { //found
                                          found = true;
                      zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.java on lines 655..663

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 72.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                                          for (Iterator<Entry<Object, EqualBeans>> it = _innerMap.entrySet().iterator(); it.hasNext();) {
                                              final Entry<Object, EqualBeans> entry = it.next();
                                              final EqualBeans beans = entry.getValue();
                                              if (equalBeans.equals(beans)) { //found
                                                  found = true;
                      zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.java on lines 606..614

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 72.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          private void dumpAssociate(TrackerNode node, int spaces) {
                              if (node.getAssociates().isEmpty())
                                  return; //don't dump if empty
                              System.out.println(dumpSpace(spaces) + "[dependents:");
                              for (TrackerNode dependent : node.getAssociates()) {
                      zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.java on lines 863..871

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 71.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          private void dumpBindings(TrackerNode node, int spaces) {
                              if (node.getBindings().isEmpty())
                                  return; //don't dump if empty
                              System.out.println(dumpSpace(spaces) + "[bindings:");
                              for (Binding binding : node.getBindings()) {
                      zkbind/src/main/java/org/zkoss/bind/tracker/impl/TrackerImpl.java on lines 853..861

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 71.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      There are no issues that match your filters.

                      Category
                      Status