zkbind/src/main/java/org/zkoss/bind/proxy/AbstractCollectionProxy.java

Summary

Maintainability
D
2 days
Test Coverage

AbstractCollectionProxy has 30 methods (exceeds 20 allowed). Consider refactoring.
Open

public abstract class AbstractCollectionProxy<E>
        implements Collection<E>, Proxy, FormProxyObject, Serializable {
    private Collection<E> _cache;
    private static final long serialVersionUID = 20141225142801L;
    private Object _origin;

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

        public boolean contains(Object o) {
            Iterator<E> e = iterator();
            if (o == null) {
                while (e.hasNext())
                    if (testEquals(e.next(), null))

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

        protected static boolean testEquals(Object e, Object o) {
            if (e == o) {
                return true;
            }
            if (e instanceof FormProxyObject) {

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

        public void setPath(String property, ProxyNode parent) {
            if (property == null && _node != null) { // means update
                _node.setParent(parent);
            } else {
                _node = new ProxyNodeImpl(property, parent);
    Severity: Minor
    Found in zkbind/src/main/java/org/zkoss/bind/proxy/AbstractCollectionProxy.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 isFormDirty has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public boolean isFormDirty() {
            if (_dirty)
                return true;
            Iterator<?> e = iterator();
            while (e.hasNext()) {
    Severity: Minor
    Found in zkbind/src/main/java/org/zkoss/bind/proxy/AbstractCollectionProxy.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 too many return statements within this method.
    Open

            return false;
    Severity: Major
    Found in zkbind/src/main/java/org/zkoss/bind/proxy/AbstractCollectionProxy.java - About 30 mins to fix

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

          protected static boolean testEquals(Object e, Object o) {
              if (e == o) {
                  return true;
              }
              if (e instanceof FormProxyObject) {
      zkbind/src/main/java/org/zkoss/bind/proxy/ListModelArrayProxy.java on lines 346..366
      zkbind/src/main/java/org/zkoss/bind/proxy/ListModelListProxy.java on lines 489..509
      zkbind/src/main/java/org/zkoss/bind/proxy/ListModelMapProxy.java on lines 364..384
      zkbind/src/main/java/org/zkoss/bind/proxy/ListModelSetProxy.java on lines 419..439

      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 133.

      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 3 locations. Consider refactoring.
      Open

          public boolean retainAll(Collection<?> c) {
              boolean modified = false;
              Iterator<E> e = iterator();
              c = createProxyObject(c); // use a proxy object to compare
              while (e.hasNext()) {
      zkbind/src/main/java/org/zkoss/bind/proxy/ListModelListProxy.java on lines 346..359
      zkbind/src/main/java/org/zkoss/bind/proxy/ListModelSetProxy.java on lines 293..306

      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 80.

      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 3 locations. Consider refactoring.
      Open

          public boolean removeAll(Collection<?> c) {
              boolean modified = false;
              Iterator<?> e = iterator();
              c = createProxyObject(c); // use a proxy object to compare
              while (e.hasNext()) {
      zkbind/src/main/java/org/zkoss/bind/proxy/ListModelListProxy.java on lines 331..344
      zkbind/src/main/java/org/zkoss/bind/proxy/ListModelSetProxy.java on lines 278..291

      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 78.

      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 3 locations. Consider refactoring.
      Open

          public void setPath(String property, ProxyNode parent) {
              if (property == null && _node != null) { // means update
                  _node.setParent(parent);
              } else {
                  _node = new ProxyNodeImpl(property, parent);
      zkbind/src/main/java/org/zkoss/bind/proxy/ListModelListProxy.java on lines 469..479
      zkbind/src/main/java/org/zkoss/bind/proxy/ListModelSetProxy.java on lines 399..409

      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 75.

      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 3 locations. Consider refactoring.
      Open

          public boolean contains(Object o) {
              Iterator<E> e = iterator();
              if (o == null) {
                  while (e.hasNext())
                      if (testEquals(e.next(), null))
      zkbind/src/main/java/org/zkoss/bind/proxy/ListModelListProxy.java on lines 251..263
      zkbind/src/main/java/org/zkoss/bind/proxy/ListModelSetProxy.java on lines 224..236

      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 68.

      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 3 locations. Consider refactoring.
      Open

          public boolean isFormDirty() {
              if (_dirty)
                  return true;
              Iterator<?> e = iterator();
              while (e.hasNext()) {
      zkbind/src/main/java/org/zkoss/bind/proxy/ListModelListProxy.java on lines 451..463
      zkbind/src/main/java/org/zkoss/bind/proxy/ListModelSetProxy.java on lines 381..393

      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 63.

      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 3 locations. Consider refactoring.
      Open

          public boolean addAll(Collection<? extends E> c) {
              boolean modified = false;
              Iterator<? extends E> e = c.iterator();
              while (e.hasNext()) {
                  if (add(e.next()))
      zkbind/src/main/java/org/zkoss/bind/proxy/ListModelListProxy.java on lines 222..232
      zkbind/src/main/java/org/zkoss/bind/proxy/ListModelSetProxy.java on lines 207..217

      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 60.

      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 4 locations. Consider refactoring.
      Open

          protected <T extends Object> T createProxyObject(T t) {
              T p = isImmutableElements ? t : ProxyHelper.createProxyIfAny(t);
              if (p instanceof FormProxyObject)
                  ((FormProxyObject) p).setPath("[$INDEX$]", _node);
              return p;
      zkbind/src/main/java/org/zkoss/bind/proxy/ListModelArrayProxy.java on lines 368..373
      zkbind/src/main/java/org/zkoss/bind/proxy/ListModelListProxy.java on lines 511..516
      zkbind/src/main/java/org/zkoss/bind/proxy/ListModelSetProxy.java on lines 441..446

      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 46.

      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