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

Summary

Maintainability
C
1 day
Test Coverage

MapProxy has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

public class MapProxy<K, V> implements Map<K, V>, Proxy, FormProxyObject, Serializable {
    private static final Logger log = LoggerFactory.getLogger(MapProxy.class);
    private Map<K, V> _cache;
    private boolean _dirty;
    private Map<K, V> _origin;
Severity: Minor
Found in zkbind/src/main/java/org/zkoss/bind/proxy/MapProxy.java - About 3 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 : _cache.entrySet()) {
    Severity: Minor
    Found in zkbind/src/main/java/org/zkoss/bind/proxy/MapProxy.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/MapProxy.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

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

        private class MapForCache<K, V> extends LinkedHashMap {
            private transient Set<Map.Entry<K, V>> _entrySetProxy = null;
            private transient Set<K> _keySetProxy = null;
            public MapForCache() {
                super();
    Severity: Major
    Found in zkbind/src/main/java/org/zkoss/bind/proxy/MapProxy.java and 1 other location - About 3 hrs to fix
    zkbind/src/main/java/org/zkoss/bind/proxy/ListModelMapProxy.java on lines 419..461

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

        private class SetHandlerForCache implements MethodHandler {
            private Set _origin;
            public SetHandlerForCache(Set origin) {
                _origin = origin;
            }
    Severity: Major
    Found in zkbind/src/main/java/org/zkoss/bind/proxy/MapProxy.java and 1 other location - About 1 hr to fix
    zkbind/src/main/java/org/zkoss/bind/proxy/ListModelMapProxy.java on lines 463..479

    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 MapProxy(Map<K, V> origin, Annotation[] callerAnnots) {
            _origin = origin;
            _cache = new MapForCache<K, V>(origin.size());
            if (callerAnnots != null) {
                for (Annotation annot : callerAnnots) {
    Severity: Major
    Found in zkbind/src/main/java/org/zkoss/bind/proxy/MapProxy.java and 1 other location - About 1 hr to fix
    zkbind/src/main/java/org/zkoss/bind/proxy/ListModelMapProxy.java on lines 57..69

    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 : _cache.entrySet()) {
                V value = me.getValue();
                if (value instanceof FormProxyObject) {
                    FormProxyObject proxyValue = (FormProxyObject) value;
                    proxyValue.submitToOrigin(ctx);
    Severity: Major
    Found in zkbind/src/main/java/org/zkoss/bind/proxy/MapProxy.java and 1 other location - About 1 hr to fix
    zkbind/src/main/java/org/zkoss/bind/proxy/ListModelMapProxy.java on lines 351..360

    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