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

Summary

Maintainability
F
4 days
Test Coverage

ListModelListProxy has 70 methods (exceeds 20 allowed). Consider refactoring.
Open

public class ListModelListProxy<E> extends ListModelList<E> implements Proxy, FormProxyObject, Serializable {
    private static final long serialVersionUID = 20210608113022L;
    private ListModelList<E> _cache;
    private ListModelList<E> _origin;
    private boolean _dirty;
Severity: Major
Found in zkbind/src/main/java/org/zkoss/bind/proxy/ListModelListProxy.java - About 1 day to fix

    File ListModelListProxy.java has 421 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /** ListModelListProxy.java.
    
        Purpose:
    
        Description:
    Severity: Minor
    Found in zkbind/src/main/java/org/zkoss/bind/proxy/ListModelListProxy.java - About 6 hrs to fix

      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))
      Severity: Minor
      Found in zkbind/src/main/java/org/zkoss/bind/proxy/ListModelListProxy.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 lastIndexOf has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public int lastIndexOf(Object o) {
              final int size = size();
              if (o == null) {
                  for (int i = size - 1; i >= 0; i--)
                      if (testEquals(get(i), null))
      Severity: Minor
      Found in zkbind/src/main/java/org/zkoss/bind/proxy/ListModelListProxy.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 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) {
      Severity: Minor
      Found in zkbind/src/main/java/org/zkoss/bind/proxy/ListModelListProxy.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 indexOf has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public int indexOf(Object o) {
              final int size = size();
              if (o == null) {
                  for (int i = 0; i < size; i++)
                      if (testEquals(get(i), null))
      Severity: Minor
      Found in zkbind/src/main/java/org/zkoss/bind/proxy/ListModelListProxy.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 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/ListModelListProxy.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/ListModelListProxy.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/ListModelListProxy.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/AbstractCollectionProxy.java on lines 242..262
        zkbind/src/main/java/org/zkoss/bind/proxy/ListModelArrayProxy.java on lines 343..363
        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 2 locations. Consider refactoring.
        Open

            public int lastIndexOf(Object o) {
                final int size = size();
                if (o == null) {
                    for (int i = size - 1; i >= 0; i--)
                        if (testEquals(get(i), null))
        zkbind/src/main/java/org/zkoss/bind/proxy/ListProxy.java on lines 88..100

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

        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

            public int indexOf(Object o) {
                final int size = size();
                if (o == null) {
                    for (int i = 0; i < size; i++)
                        if (testEquals(get(i), null))
        zkbind/src/main/java/org/zkoss/bind/proxy/ListProxy.java on lines 74..86

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

        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

            public void submitToOrigin(BindContext ctx) {
                Collection<E> origin = ((Collection<E>) getOriginObject());
                origin.clear();
                for (E e : _cache) {
                    if (e instanceof FormProxyObject) {
        zkbind/src/main/java/org/zkoss/bind/proxy/ListModelSetProxy.java on lines 366..379

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

        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/AbstractCollectionProxy.java on lines 202..215
        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/AbstractCollectionProxy.java on lines 173..186
        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/AbstractCollectionProxy.java on lines 283..293
        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/AbstractCollectionProxy.java on lines 106..118
        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/AbstractCollectionProxy.java on lines 188..200
        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/AbstractCollectionProxy.java on lines 153..163
        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/AbstractCollectionProxy.java on lines 268..273
        zkbind/src/main/java/org/zkoss/bind/proxy/ListModelArrayProxy.java on lines 365..370
        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