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

Summary

Maintainability
F
3 days
Test Coverage

ListModelMapProxy has 62 methods (exceeds 20 allowed). Consider refactoring.
Open

public class ListModelMapProxy<K, V> extends ListModelMap<K, V> implements Proxy, FormProxyObject, Serializable {
    private static final long serialVersionUID = 20210608113022L;
    private static final Logger log = LoggerFactory.getLogger(ListModelMapProxy.class);
    private MapForCache<K, V> _cache;
    private ListModelMap<K, V> _origin;
Severity: Major
Found in zkbind/src/main/java/org/zkoss/bind/proxy/ListModelMapProxy.java - About 1 day to fix

    File ListModelMapProxy.java has 380 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

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

          public boolean isFormDirty() {
              if (_dirty) {
                  return true;
              } else {
                  for (Map.Entry<K, V> me : getCache().entrySet()) {
      Severity: Minor
      Found in zkbind/src/main/java/org/zkoss/bind/proxy/ListModelMapProxy.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/ListModelMapProxy.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/ListModelMapProxy.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 too many return statements within this method.
      Open

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

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

            private class MapForCache<K, V> extends ListModelMap<K, V> {
                private transient Set<Map.Entry<K, V>> _entrySetProxy = null;
                private transient Set<K> _keySetProxy = null;
        
                public MapForCache() {
        zkbind/src/main/java/org/zkoss/bind/proxy/MapProxy.java on lines 236..273

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

        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 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/ListModelListProxy.java on lines 489..509
        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

            private class SetHandlerForCache implements MethodHandler {
                private Set _origin;
        
                public SetHandlerForCache(Set origin) {
                    _origin = origin;
        zkbind/src/main/java/org/zkoss/bind/proxy/MapProxy.java on lines 275..289

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

        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

            public ListModelMapProxy(ListModelMap<K, V> origin, Annotation[] callerAnnots) {
                _origin = origin;
                _cache = new ListModelMapProxy<K, V>.MapForCache<>(origin.size());
                if (callerAnnots != null) {
                    for (Annotation annot : callerAnnots) {
        zkbind/src/main/java/org/zkoss/bind/proxy/MapProxy.java on lines 54..66

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

        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 (Map.Entry<K, V> me : getCache().entrySet()) {
                    V value = me.getValue();
                    if (value instanceof FormProxyObject) {
                        FormProxyObject proxyValue = (FormProxyObject) value;
                        proxyValue.submitToOrigin(ctx);
        zkbind/src/main/java/org/zkoss/bind/proxy/MapProxy.java on lines 98..107

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

        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