zkbind/src/main/java/org/zkoss/bind/impl/ValidationMessagesImpl.java

Summary

Maintainability
D
2 days
Test Coverage

ValidationMessagesImpl has 35 methods (exceeds 20 allowed). Consider refactoring.
Open

public class ValidationMessagesImpl implements ValidationMessages, Collection<Object>, Serializable {
    //this class implement collection to support empty expression in EL
    private static final long serialVersionUID = 1L;

    // null objects
Severity: Minor
Found in zkbind/src/main/java/org/zkoss/bind/impl/ValidationMessagesImpl.java - About 4 hrs to fix

    File ValidationMessagesImpl.java has 296 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* ValidationMessagesImpl.java
    
        Purpose:
            
        Description:
    Severity: Minor
    Found in zkbind/src/main/java/org/zkoss/bind/impl/ValidationMessagesImpl.java - About 3 hrs to fix

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

          public void setMessages(Component comp, String attr, String key, String[] messages, Object value) {
      Severity: Minor
      Found in zkbind/src/main/java/org/zkoss/bind/impl/ValidationMessagesImpl.java - About 35 mins to fix

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

            public void addMessages(Component comp, String attr, String key, String[] messages, Object value) {
        Severity: Minor
        Found in zkbind/src/main/java/org/zkoss/bind/impl/ValidationMessagesImpl.java - About 35 mins to fix

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

              public void clearMessages(Component comp, String attr) {
                  List<Message> compMsgs = _compMsgsMap.get(comp);
                  if (compMsgs == null || compMsgs.size() == 0) {
                      return;
                  }
          Severity: Minor
          Found in zkbind/src/main/java/org/zkoss/bind/impl/ValidationMessagesImpl.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 clearKeyMessages has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public void clearKeyMessages(Component comp, String key) {
                  List<Message> compMsgs = _compMsgsMap.get(comp);
                  if (compMsgs == null || compMsgs.size() == 0) {
                      return;
                  }
          Severity: Minor
          Found in zkbind/src/main/java/org/zkoss/bind/impl/ValidationMessagesImpl.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 addMessages has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public void addMessages(Component comp, String attr, String key, String[] messages, Object value) {
                  List<Message> compMsgs = _compMsgsMap.get(comp);
                  if (compMsgs == null) {
                      _compMsgsMap.put(comp, compMsgs = new ArrayList<Message>());
                  }
          Severity: Minor
          Found in zkbind/src/main/java/org/zkoss/bind/impl/ValidationMessagesImpl.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 clearKeyMessages has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public void clearKeyMessages(String key) {
                  List<Message> keyMsgs = _keyMsgsMap.get(key);
                  if (keyMsgs == null || keyMsgs.size() == 0) {
                      return;
                  }
          Severity: Minor
          Found in zkbind/src/main/java/org/zkoss/bind/impl/ValidationMessagesImpl.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

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

              public void clearMessages(Component comp, String attr) {
                  List<Message> compMsgs = _compMsgsMap.get(comp);
                  if (compMsgs == null || compMsgs.size() == 0) {
                      return;
                  }
          zkbind/src/main/java/org/zkoss/bind/impl/ValidationMessagesImpl.java on lines 105..124

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

          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 void clearKeyMessages(Component comp, String key) {
                  List<Message> compMsgs = _compMsgsMap.get(comp);
                  if (compMsgs == null || compMsgs.size() == 0) {
                      return;
                  }
          zkbind/src/main/java/org/zkoss/bind/impl/ValidationMessagesImpl.java on lines 84..103

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

          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 String[] getMessages(Component comp, String attr) {
                  List<Message> compMsgs = _compMsgsMap.get(comp);
                  if (compMsgs == null || compMsgs.size() == 0) {
                      return EMPTY_STRING_ARRAY;
                  }
          zkbind/src/main/java/org/zkoss/bind/impl/ValidationMessagesImpl.java on lines 190..201

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

          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 String[] getKeyMessages(Component comp, String key) {
                  List<Message> compMsgs = _compMsgsMap.get(comp);
                  if (compMsgs == null || compMsgs.size() == 0) {
                      return EMPTY_STRING_ARRAY;
                  }
          zkbind/src/main/java/org/zkoss/bind/impl/ValidationMessagesImpl.java on lines 153..164

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

          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 Object[] getFieldValues(String key) {
                  List<Message> keyMsgs = _keyMsgsMap.get(key);
                  if (keyMsgs == null || keyMsgs.size() == 0) {
                      return EMPTY_OBJECT_ARRAY;
                  }
          zkbind/src/main/java/org/zkoss/bind/impl/ValidationMessagesImpl.java on lines 301..310

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

          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 Component[] getAssociates(String key) {
                  List<Message> keyMsgs = _keyMsgsMap.get(key);
                  if (keyMsgs == null || keyMsgs.size() == 0) {
                      return EMPTY_COMPONENT_ARRAY;
                  }
          zkbind/src/main/java/org/zkoss/bind/impl/ValidationMessagesImpl.java on lines 274..283

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

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

                  public Message(Component comp, String attr, String key, String msg, Object value) {
                      this.comp = comp;
                      this.attr = attr;
                      this.key = key;
                      this.msg = msg;
          zel/src/main/java/org/zkoss/zel/impl/ValueExpressionImpl.java on lines 104..111
          zkbind/src/main/java/org/zkoss/bind/impl/ValidationContextImpl.java on lines 40..47
          zktest/src/main/java/org/zkoss/zktest/test2/B70_ZK_2779_ViewModel.java on lines 99..106
          zktest/src/main/java/org/zkoss/zktest/test2/F90_ZK_4375VM.java on lines 85..91

          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

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

              public Object getFieldValue(String key) {
                  List<Message> keyMsgs = _keyMsgsMap.get(key);
                  if (keyMsgs == null || keyMsgs.size() == 0) {
                      return null;
                  }
          zkbind/src/main/java/org/zkoss/bind/impl/ValidationMessagesImpl.java on lines 293..299

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

          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 Component getAssociate(String key) {
                  List<Message> keyMsgs = _keyMsgsMap.get(key);
                  if (keyMsgs == null || keyMsgs.size() == 0) {
                      return null;
                  }
          zkbind/src/main/java/org/zkoss/bind/impl/ValidationMessagesImpl.java on lines 261..267

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

          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

                      if (key != null) {
                          List<Message> keyMsgs = _keyMsgsMap.get(key);
                          if (keyMsgs == null) {
                              _keyMsgsMap.put(key, keyMsgs = new ArrayList<Message>());
                          }
          zkbind/src/main/java/org/zkoss/bind/tracker/impl/BindUiLifeCycle.java on lines 296..303

          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