zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java

Summary

Maintainability
F
1 wk
Test Coverage

File UiVisualizer.java has 705 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* UiVisualizer.java

    Purpose:
        
    Description:
Severity: Major
Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 1 day to fix

    Method getResponses has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
    Open

        public List<AuResponse> getResponses(Collection<Component> renderedComps) throws IOException {
            _ending = true; //no more modifying UI (invalidate/addSmartUpdate...)
    
            /*        if (log.finerable())
                        log.finer("ei: "+this+"\nInvalidated: "+_invalidated+"\nSmart Upd: "+_smartUpdated
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 1 day 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

    UiVisualizer has 46 methods (exceeds 20 allowed). Consider refactoring.
    Open

    /*package*/ class UiVisualizer implements Visualizer {
        //    private static final Logger log = LoggerFactory.getLogger(UiVisualizer.class);
    
        /** The parent exec info. */
        private final UiVisualizer _parent;
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 6 hrs to fix

      Method removeRedundant has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
      Open

          private void removeRedundant() {
              int initsz = (_invalidated.size() + _attached.size()) / 2 + 30;
              final Set<Component> ins = new HashSet<Component>(initsz), //one of ancestor in _invalidated or _attached
                      outs = new HashSet<Component>(initsz); //none of ancestor in _invalidated nor _attached
              final List<Component> ancs = new ArrayList<Component>(50);
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 6 hrs 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 addResponsesForCreatedPerSiblings has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

          private static void addResponsesForCreatedPerSiblings(List<AuResponse> responses, Set<Component> newsibs,
                  Map<Component, Set<? extends Component>> croppingInfos) throws IOException {
              final Component parent;
              final Page page;
              {
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 4 hrs 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 getResponses has 105 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public List<AuResponse> getResponses(Collection<Component> renderedComps) throws IOException {
              _ending = true; //no more modifying UI (invalidate/addSmartUpdate...)
      
              /*        if (log.finerable())
                          log.finer("ei: "+this+"\nInvalidated: "+_invalidated+"\nSmart Upd: "+_smartUpdated
      Severity: Major
      Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 4 hrs to fix

        Method crop has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            private void crop(Set coll, Map<Component, Set<? extends Component>> croppingInfos, boolean bResponse) {
                for (Iterator it = coll.iterator(); it.hasNext();) {
                    final Object o = it.next();
                    if (!(o instanceof Component))
                        continue;
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 3 hrs 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

        Consider simplifying this complex logical expression.
        Open

                if (_recovering || _disabled || (newpg == null && oldpg == null)
                        || (newpg == null && (oldpg instanceof VolatilePage || !_exec.isAsyncUpdate(oldpg))) //detach from loading pg
                        || (oldpg == null && (newpg instanceof VolatilePage || !_exec.isAsyncUpdate(newpg))) //attach to loading pg
                        || isCUDisabled(comp) || (oldparent != null && isCUDisabled(oldparent)))
                    return; //to avoid redundant AuRemove
        Severity: Critical
        Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 3 hrs to fix

          Method checkPageRemoved has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              private void checkPageRemoved(Set<Component> removed) {
                  //1. scan once
                  final Desktop desktop = _exec.getDesktop();
                  Set<Page> pages = null;
                  for (Page page : desktop.getPages()) {
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 2 hrs 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 addResponse has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              public void addResponse(String key, AuResponse response, int priority) {
                  if (response == null)
                      throw new IllegalArgumentException();
          
                  //relative fix BUG ZK-1464
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 2 hrs 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 removeRedundant has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private void removeRedundant() {
                  int initsz = (_invalidated.size() + _attached.size()) / 2 + 30;
                  final Set<Component> ins = new HashSet<Component>(initsz), //one of ancestor in _invalidated or _attached
                          outs = new HashSet<Component>(initsz); //none of ancestor in _invalidated nor _attached
                  final List<Component> ancs = new ArrayList<Component>(50);
          Severity: Major
          Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 2 hrs to fix

            Method addMoved has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                public void addMoved(Component comp, Component oldparent, Page oldpg, Page newpg) {
                    if (_recovering || _disabled || (newpg == null && oldpg == null)
                            || (newpg == null && (oldpg instanceof VolatilePage || !_exec.isAsyncUpdate(oldpg))) //detach from loading pg
                            || (oldpg == null && (newpg instanceof VolatilePage || !_exec.isAsyncUpdate(newpg))) //attach to loading pg
                            || isCUDisabled(comp) || (oldparent != null && isCUDisabled(oldparent)))
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 2 hrs 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 addResponsesForCreatedPerSiblings has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static void addResponsesForCreatedPerSiblings(List<AuResponse> responses, Set<Component> newsibs,
                        Map<Component, Set<? extends Component>> croppingInfos) throws IOException {
                    final Component parent;
                    final Page page;
                    {
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 1 hr to fix

              Method checkPageRemoved has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private void checkPageRemoved(Set<Component> removed) {
                      //1. scan once
                      final Desktop desktop = _exec.getDesktop();
                      Set<Page> pages = null;
                      for (Page page : desktop.getPages()) {
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 1 hr to fix

                Method doDetached has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    private void doDetached() {
                        l_out: for (Map.Entry<Component, Component> me : _detached.entrySet()) {
                            Component p = me.getValue();
                            for (; p != null; p = p.getParent())
                                if (_moved.contains(p) || _detached.containsKey(p) || _invalidated.contains(p) || _attached.contains(p))
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.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 addResponse has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public void addResponse(String key, AuResponse response, int priority) {
                        if (response == null)
                            throw new IllegalArgumentException();
                
                        //relative fix BUG ZK-1464
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 1 hr to fix

                  Method doMoved has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private Set<Component> doMoved(List<AuResponse> responses) {
                          //Remove components that have to removed from the client
                          final Set<Component> removed = new LinkedHashSet<Component>();
                          for (Component comp : _moved) {
                              final Page page = comp.getPage();
                  Severity: Minor
                  Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.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

                  Consider simplifying this complex logical expression.
                  Open

                          if (_recovering || _disabled || page == null || page instanceof VolatilePage || !_exec.isAsyncUpdate(page)
                                  || _invalidated.contains(comp) || isCUDisabled(comp))
                              return null; //nothing to do
                  Severity: Major
                  Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 1 hr to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if (ck != null && ck.getParent() == parent) {
                                                newsibs.add(ck);
                                                attached[k] = null;
                                            }
                    Severity: Major
                    Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 45 mins to fix

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

                              public int compareTo(Object o) {
                                  final TimedValue tv = (TimedValue) o;
                                  return _priority == tv._priority ? _timed > tv._timed ? 1 : _timed == tv._timed ? 0 : -1
                                          : _priority > tv._priority ? -1 : 1; //higher priority, earlier (smaller)
                              }
                      Severity: Minor
                      Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 45 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

                      Consider simplifying this complex logical expression.
                      Open

                              if (_recovering || _disabled || page == null || page instanceof VolatilePage || !_exec.isAsyncUpdate(page)
                                      || isCUDisabled(comp))
                                  return; //nothing to do
                      Severity: Major
                      Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 40 mins to fix

                        Consider simplifying this complex logical expression.
                        Open

                                        if (ownerPage == null //detached
                                                || (_pgInvalid != null && _pgInvalid.contains(ownerPage))
                                                || isAncestor(_invalidated, owner, true) || isAncestor(_attached, owner, true)
                                                || isAncestor(removed, owner, true)) {
                                            addPageRemoved(page);
                        Severity: Major
                        Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 40 mins to fix

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

                              private void addSmartUpdate0(Component comp, String attr, Object value, boolean append, int priority) {
                          Severity: Minor
                          Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 35 mins to fix

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

                                private void clearInInvalidPage(Collection<Component> coll) {
                                    for (Iterator<Component> it = coll.iterator(); it.hasNext();) {
                                        final Component comp = it.next();
                                        final Page page = comp.getPage();
                                        if (page != null && ((_pgRemoved != null && _pgRemoved.contains(page))
                            Severity: Minor
                            Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.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 getAvailableAtClient has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                private static Set<? extends Component> getAvailableAtClient(Component comp,
                                        Map<Component, Set<? extends Component>> croppingInfos) {
                                    final Object xc = ((ComponentCtrl) comp).getExtraCtrl();
                                    if (xc instanceof Cropper) {
                                        //we don't need to check isCropper first since its component's job
                            Severity: Minor
                            Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.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

                            Method addInvalidate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public void addInvalidate(Component comp) {
                                    final Page page = comp.getPage();
                                    if (_recovering || _disabled || page == null || page instanceof VolatilePage || !_exec.isAsyncUpdate(page)
                                            || isCUDisabled(comp))
                                        return; //nothing to do
                            Severity: Minor
                            Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.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

                            Method isCUDisabled has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                private final boolean isCUDisabled(Component comp) {
                                    if (_updDisabled != null) {
                                        //no need to check comp.getPage() since it was checked before calling
                                        for (; comp != null; comp = comp.getParent())
                                            if (_updDisabled.contains(comp))
                            Severity: Minor
                            Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.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

                            Method addSmartUpdate0 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                private void addSmartUpdate0(Component comp, String attr, Object value, boolean append, int priority) {
                                    if (comp == null)
                                        throw new IllegalArgumentException();
                                    //main fix for BUG ZK-1464
                                    if (_ending && (comp.getPage() == null || (_pgRemoved != null && _pgRemoved.contains(comp.getPage())))) {
                            Severity: Minor
                            Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.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

                            Method disableClientUpdate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public boolean disableClientUpdate(Component comp, boolean disable) {
                                    if (disable) {
                                        if (_updDisabled == null)
                                            _updDisabled = new HashSet<Component>(4);
                                        return !_updDisabled.add(comp);
                            Severity: Minor
                            Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.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

                            Method isAncestor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                private boolean isAncestor(Collection<Component> coll, Component comp, boolean includingEquals) {
                                    for (Iterator<Component> it = coll.iterator(); it.hasNext();) {
                                        final Component c = it.next();
                                        if ((includingEquals || c != comp) && Components.isAncestor(c, comp))
                                            return true;
                            Severity: Minor
                            Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.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

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

                                        while ((p = p.getParent()) != null) { //don't check p in _invalidated
                                            if (outs.contains(p)) //checked
                                                break;
                                            if (ins.contains(p) || _invalidated.contains(p) || _attached.contains(p)) {
                                                it.remove();
                            Severity: Major
                            Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java and 1 other location - About 1 hr to fix
                            zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java on lines 971..980

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

                            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

                                        while ((p = p.getParent()) != null) { //don't check p in _attached
                                            if (outs.contains(p)) //checked
                                                break;
                                            if (ins.contains(p) || _invalidated.contains(p) || _attached.contains(p)) {
                                                it.remove();
                            Severity: Major
                            Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java and 1 other location - About 1 hr to fix
                            zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java on lines 950..959

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

                            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