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

Summary

Maintainability
D
2 days
Test Coverage

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

/*package*/ class PropertyBindingHandler extends AbstractBindingHandler {
    private static final long serialVersionUID = 1L;

    private static final Logger _log = LoggerFactory.getLogger(PropertyBindingHandler.class);

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

    File PropertyBindingHandler.java has 293 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      Method doValidateSaveEvent has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private boolean doValidateSaveEvent(Component comp, SavePropertyBinding binding, Event evt, Set<Property> notifys) {
              //for a single binding, if it doesn't need to do validation, then we don't need to anything.
              if (binding.hasValidator()) {
                  final BindContext ctx = BindContextUtil.newBindContext(_binder, binding, true, null, binding.getComponent(),
                          evt);

        Method doValidateSaveEvent has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            private boolean doValidateSaveEvent(Component comp, SavePropertyBinding binding, Event evt, Set<Property> notifys) {
                //for a single binding, if it doesn't need to do validation, then we don't need to anything.
                if (binding.hasValidator()) {
                    final BindContext ctx = BindContextUtil.newBindContext(_binder, binding, true, null, binding.getComponent(),
                            evt);

        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 doSaveBinding has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            private void doSaveBinding(Component comp, SavePropertyBinding binding, String command, Event evt,
                    Set<Property> notifys) {
        Severity: Minor
        Found in zkbind/src/main/java/org/zkoss/bind/impl/PropertyBindingHandler.java - About 35 mins to fix

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

              boolean doSaveEvent(BindingKey bkey, Component comp, Event evt, Set<Property> notifys) {
                  final List<SavePropertyBinding> bindings = _saveEventBindings.get(bkey);
                  if (bindings != null) {
                      boolean valid = true;
                      for (SavePropertyBinding binding : bindings) {
          Severity: Minor
          Found in zkbind/src/main/java/org/zkoss/bind/impl/PropertyBindingHandler.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 toCollectedProperties has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              Map<String, Property[]> toCollectedProperties(Set<Property> validates) {
                  if (validates == null || validates.size() == 0)
                      return Collections.emptyMap();
                  Map<String, List<Property>> temp = new HashMap<String, List<Property>>(validates.size());
          
          
          Severity: Minor
          Found in zkbind/src/main/java/org/zkoss/bind/impl/PropertyBindingHandler.java - About 25 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

                  try {
                      if (_log.isDebugEnabled()) {
                          _log.debug(debugInfo);
                      }
                      doPrePhase(Phase.LOAD_BINDING, ctx);
          zkbind/src/main/java/org/zkoss/bind/impl/FormBindingHandler.java on lines 136..151

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

          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

              void removeBindings(Collection<Binding> removes) {
                  for (List<LoadPropertyBinding> bindings : _loadAfterBindings.values()) {
                      bindings.removeAll(removes); //command -> bindings (load after command)
                  }
                  for (List<SavePropertyBinding> bindings : _saveAfterBindings.values()) {
          zkbind/src/main/java/org/zkoss/bind/impl/FormBindingHandler.java on lines 191..204

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

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

                  try {
                      if (_log.isDebugEnabled()) {
                          _log.debug(debugInfo);
                      }
                      doPrePhase(Phase.SAVE_BINDING, ctx);
          zkbind/src/main/java/org/zkoss/bind/impl/BinderImpl.java on lines 513..523
          zkbind/src/main/java/org/zkoss/bind/impl/ChildrenBindingHandler.java on lines 92..102
          zkbind/src/main/java/org/zkoss/bind/impl/FormBindingHandler.java on lines 109..119

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

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

              void doSaveBefore(Component comp, String command, Event evt, Set<Property> notifys) {
                  final List<SavePropertyBinding> bindings = _saveBeforeBindings.get(command);
                  if (bindings != null) {
                      for (SavePropertyBinding binding : bindings) {
                          doSaveBinding(comp, binding, command, evt, notifys);
          zkbind/src/main/java/org/zkoss/bind/impl/FormBindingHandler.java on lines 92..99
          zkbind/src/main/java/org/zkoss/bind/impl/FormBindingHandler.java on lines 154..161
          zkbind/src/main/java/org/zkoss/bind/impl/PropertyBindingHandler.java on lines 286..294

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

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

              void doSaveAfter(Component comp, String command, Event evt, Set<Property> notifys) {
                  //        final BindEvaluatorX eval = getEvaluatorX(); 
                  final List<SavePropertyBinding> bindings = _saveAfterBindings.get(command);
                  if (bindings != null) {
                      for (SavePropertyBinding binding : bindings) {
          zkbind/src/main/java/org/zkoss/bind/impl/FormBindingHandler.java on lines 92..99
          zkbind/src/main/java/org/zkoss/bind/impl/FormBindingHandler.java on lines 154..161
          zkbind/src/main/java/org/zkoss/bind/impl/PropertyBindingHandler.java on lines 277..284

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

          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

              void doLoadAfter(Component comp, String command) {
                  final List<LoadPropertyBinding> bindings = _loadAfterBindings.get(command);
                  if (bindings != null) {
                      for (LoadPropertyBinding binding : bindings) {
                          doLoadBinding(comp, binding, command, null);
          zkbind/src/main/java/org/zkoss/bind/impl/PropertyBindingHandler.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 49.

          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

              void doInit(Component comp, BindingKey bkey) {
                  final List<InitPropertyBinding> initBindings = _initBindings.get(bkey);
                  if (initBindings != null) {
                      for (InitPropertyBinding binding : initBindings) {
                          doLoadBinding(comp, binding, null, null);
          zkbind/src/main/java/org/zkoss/bind/impl/PropertyBindingHandler.java on lines 345..352

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

          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

              void doLoad(Component comp, BindingKey bkey) {
                  final List<LoadPropertyBinding> propBindings = _loadPromptBindings.get(bkey);
                  if (propBindings != null) {
                      for (LoadPropertyBinding binding : propBindings) {
                          doLoadBinding(comp, binding, null, null);
          zkbind/src/main/java/org/zkoss/bind/impl/PropertyBindingHandler.java on lines 354..361

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

          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

              void doLoadBefore(Component comp, String command) {
                  final List<LoadPropertyBinding> bindings = _loadBeforeBindings.get(command);
                  if (bindings != null) {
                      for (LoadPropertyBinding binding : bindings) {
                          doLoadBinding(comp, binding, command, null);
          zkbind/src/main/java/org/zkoss/bind/impl/PropertyBindingHandler.java on lines 305..312

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

          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