zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelSetVM.java

Summary

Maintainability
D
1 day
Test Coverage

Method equals has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        @Override
        public boolean equals(Object obj) {
            if (this == obj)
                return true;
            if (obj == null)

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;

    Avoid too many return statements within this method.
    Open

                return true;

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

          public static class Tag implements Serializable {
              private String value;
      
              public Tag() {
              }
      zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormWithList.java on lines 215..266
      zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormWithMap.java on lines 218..269
      zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormWithSet.java on lines 217..268
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelArrayVM.java on lines 168..219
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelListVM.java on lines 197..248
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelMapVM.java on lines 198..249

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

      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

          public void doDeserialize0(Window win, Label msg) throws Exception {
              ByteArrayInputStream oaos = new ByteArrayInputStream(_bytes);
              ObjectInputStream oos = new ObjectInputStream(oaos);
              Window newwin = (Window) oos.readObject();
              Component parent = win.getParent();
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelArrayVM.java on lines 111..124
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelListVM.java on lines 138..152
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelMapVM.java on lines 141..155

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

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

          public static class Item implements Serializable {
      
              private String name;
              private Tag mainTag;
              private Set<Tag> tags;
      zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormWithList.java on lines 174..213
      zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormWithMap.java on lines 177..216
      zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormWithSet.java on lines 176..215
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelArrayVM.java on lines 126..166
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelListVM.java on lines 154..195
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelMapVM.java on lines 157..196

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

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

          public void doSerialize0(Window win, Label msg) throws Exception {
              Page pg = win.getPage();
              ((ComponentCtrl) win).sessionWillPassivate(pg);//simulate
              ByteArrayOutputStream oaos = new ByteArrayOutputStream();
              ObjectOutputStream oos = new ObjectOutputStream(oaos);
      zktest/src/main/java/org/zkoss/zktest/bind/issue/B00869Serialization.java on lines 117..126
      zktest/src/main/java/org/zkoss/zktest/bind/issue/F02545ChildrenBindingSupportListModelVM.java on lines 139..148
      zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormWithList.java on lines 145..154
      zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormWithMap.java on lines 149..158
      zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormWithSet.java on lines 148..157
      zktest/src/main/java/org/zkoss/zktest/test2/F80_ZK_2831.java on lines 99..108
      zktest/src/main/java/org/zkoss/zktest/test2/F85_ZK_3816VM.java on lines 77..86
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelArrayVM.java on lines 100..109
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelListVM.java on lines 127..136
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelMapVM.java on lines 130..139
      zktest/src/main/java/org/zkoss/zktest/zats/zuti/vm/ForEachListModelVM.java on lines 135..144

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

          private void loadCurrentItem() {
              currentItem = new Item();
              currentItem.setName(dbItemName);
              currentItem.setMainTag(new Tag(dbMainTagValue));
              currentItem.setTags(new LinkedHashSet<Tag>());
      zktest/src/main/java/org/zkoss/zktest/bind/issue/B02078.java on lines 81..89
      zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormWithList.java on lines 109..117
      zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormWithSet.java on lines 112..120
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelArrayVM.java on lines 61..69
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelListVM.java on lines 88..96

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

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

          public void doSerialize(Window win, Label msg) {
              try {
                  doSerialize0(win, msg);
                  doDeserialize0(win, msg);
              } catch (Exception x) {
      zktest/src/main/java/org/zkoss/zktest/bind/issue/B00869Serialization.java on lines 108..116
      zktest/src/main/java/org/zkoss/zktest/bind/issue/F02545ChildrenBindingMapTestVM.java on lines 69..77
      zktest/src/main/java/org/zkoss/zktest/bind/issue/F02545ChildrenBindingSupportListModelVM.java on lines 129..137
      zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormWithList.java on lines 136..144
      zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormWithMap.java on lines 140..148
      zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormWithSet.java on lines 139..147
      zktest/src/main/java/org/zkoss/zktest/test2/F80_ZK_2831.java on lines 90..98
      zktest/src/main/java/org/zkoss/zktest/test2/F85_ZK_3816VM.java on lines 65..73
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelArrayVM.java on lines 90..98
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelListVM.java on lines 117..125
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelMapVM.java on lines 121..129
      zktest/src/main/java/org/zkoss/zktest/zats/zuti/vm/ForEachListModelVM.java on lines 125..133

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

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

          private void saveCurrentItem() {
              dbItemName = currentItem.getName();
              dbMainTagValue = currentItem.getMainTag().getValue();
              dbTagValues.clear();
              for (Tag tag : currentItem.getTags()) {
      zktest/src/main/java/org/zkoss/zktest/bind/issue/B02078.java on lines 91..98
      zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormWithList.java on lines 119..126
      zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormWithSet.java on lines 122..129
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelArrayVM.java on lines 71..78
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelListVM.java on lines 98..105

      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

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

          @Init
          public void init() {
              loadCurrentItem();
              bunchTags = new ListModelSet<Tag>(3);
              bunchTags.add(new Tag("addAll1"));
      zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormWithList.java on lines 52..59
      zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormWithSet.java on lines 55..62
      zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4394_ListModelListVM.java on lines 31..38

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

      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

          @Command("addTag")
          public void onAddTag(@BindingParam("form") Item form,
                               @BindingParam("tagValue") String tagValue) {
              Set<Tag> tags = (Set<Tag>) form.getTags();
              tags.add(new Tag(tagValue));
      zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormWithSet.java on lines 82..88

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

      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