zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java

Summary

Maintainability
F
2 wks
Test Coverage

File HtmlShadowElement.java has 1321 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/** HtmlShadowElement.java.

    Purpose:
        
    Description:
Severity: Major
Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 3 days to fix

    HtmlShadowElement has 73 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public abstract class HtmlShadowElement extends AbstractComponent implements ShadowElement, ShadowElementCtrl {
        private static final Logger log = LoggerFactory.getLogger(HtmlShadowElement.class);
        private static final long serialVersionUID = 20141022145906L;
        private Component _firstInsertion;
        private Component _lastInsertion;
    Severity: Major
    Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 1 day to fix

      Method adjustInsertionForRemove has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
      Open

          private boolean adjustInsertionForRemove(HtmlShadowElement se, Component removed) {
              Component old = null;
              Direction direction = inRange(se, removed);
              switch (direction) {
              case PREVIOUS:
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 7 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 mergeSubTree has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

          protected void mergeSubTree() {
              List<HtmlShadowElement> children = getChildren();
              if (children == null || children.isEmpty())
                  return; // nothing to do.
              if (_parent != null) {
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 setShadowHost has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
      Open

          public void setShadowHost(Component host, Component insertBefore) {
              if (getParent() != null) {
                  throw new UiException("As a shadow child cannot be a shadow root. [" + this + "]");
              }
              if (host == null) {
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 beforeHostChildAdded has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          public void beforeHostChildAdded(Component child, Component insertBefore, int indexOfInsertBefore) {
              if (log.isDebugEnabled()) {
                  log.debug("beforeHostChildAdded " + child + ", " + insertBefore + ", in this shadow "
                          + ShadowElementsCtrl.getCurrentInfo());
              }
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 5 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 beforeHostChildRemoved has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

          public void beforeHostChildRemoved(Component child, int indexOfChild) {
              if (log.isDebugEnabled()) {
                  log.debug("beforeHostChildRemoved " + child + ", in this shadow " + ShadowElementsCtrl.getCurrentInfo());
              }
      
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 afterHostChildAdded has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          public void afterHostChildAdded(Component child, int indexOfChild) {
              if (log.isDebugEnabled()) {
                  log.debug("afterHostChildAdded " + child + ", in this shadow " + ShadowElementsCtrl.getCurrentInfo());
              }
              Object currentInfo = ShadowElementsCtrl.getCurrentInfo();
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 beforeChildAdded has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          public void beforeChildAdded(Component child, Component refChild) {
              if (!(child instanceof ShadowElement))
                  throw new UiException("Unsupported child for shadow element: " + child);
              if (refChild != null && !(refChild instanceof ShadowElement))
                  throw new UiException("Unsupported refChild for shadow element: " + refChild);
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 clearChildren has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public void clearChildren() {
              AbstractComponent hostIfAny = (AbstractComponent) getShadowHostIfAny();
              try {
                  if (hostIfAny != null) {
                      hostIfAny.disableHostChanged();
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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

      Method adjustInsertionForInsertBefore has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          private boolean adjustInsertionForInsertBefore(HtmlShadowElement se, Component target, Component insertBefore) {
              Component old = null;
              Direction direction = inRange(se, insertBefore);
              switch (direction) {
              case PREVIOUS:
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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

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

          public static Direction inRange(HtmlShadowElement se, Component target) {
              Component hostIfAny = se.getShadowHostIfAny();
              Map<Component, Integer> oldCacheMap = se.getIndexCacheMap(hostIfAny);
              final boolean destroyCacheMap = oldCacheMap == null;
              try {
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 setShadowHost has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public void setShadowHost(Component host, Component insertBefore) {
              if (getParent() != null) {
                  throw new UiException("As a shadow child cannot be a shadow root. [" + this + "]");
              }
              if (host == null) {
      Severity: Major
      Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 2 hrs to fix

        Method adjustInsertionForRemove has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private boolean adjustInsertionForRemove(HtmlShadowElement se, Component removed) {
                Component old = null;
                Direction direction = inRange(se, removed);
                switch (direction) {
                case PREVIOUS:
        Severity: Major
        Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 2 hrs to fix

          Method beforeHostChildRemoved has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public void beforeHostChildRemoved(Component child, int indexOfChild) {
                  if (log.isDebugEnabled()) {
                      log.debug("beforeHostChildRemoved " + child + ", in this shadow " + ShadowElementsCtrl.getCurrentInfo());
                  }
          
          Severity: Major
          Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 2 hrs to fix

            Method mergeSubTree has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected void mergeSubTree() {
                    List<HtmlShadowElement> children = getChildren();
                    if (children == null || children.isEmpty())
                        return; // nothing to do.
                    if (_parent != null) {
            Severity: Major
            Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 2 hrs to fix

              Method afterHostChildAdded has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public void afterHostChildAdded(Component child, int indexOfChild) {
                      if (log.isDebugEnabled()) {
                          log.debug("afterHostChildAdded " + child + ", in this shadow " + ShadowElementsCtrl.getCurrentInfo());
                      }
                      Object currentInfo = ShadowElementsCtrl.getCurrentInfo();
              Severity: Major
              Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 2 hrs to fix

                Method getIndex has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static int getIndex(ShadowElement owner, Component insertion, Map<Component, Integer> cacheMap) {
                        if (insertion == null)
                            return -1;
                        if (insertion.getParent() == null) {
                            if (owner == null) {
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 fillUpIndexMap has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    private Map<Component, Integer> fillUpIndexMap(Component first, Component last) {
                        if (first == null) // last will be null too 
                            return getIndexMap(getShadowHostIfAny());
                        Component parent = first.getParent();
                        if (parent == null)
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 isDynamicValue has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public boolean isDynamicValue() {
                        if (_dynamicValue == null) {
                            final ComponentCtrl ctrl = this;
                            List<String> props = ctrl.getAnnotatedProperties();
                            if (props != null) {
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 clearChildren has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public void clearChildren() {
                        AbstractComponent hostIfAny = (AbstractComponent) getShadowHostIfAny();
                        try {
                            if (hostIfAny != null) {
                                hostIfAny.disableHostChanged();
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 1 hr to fix

                  Method stretchRange has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected void stretchRange(Component firstChild, Component lastChild) {
                          if (firstChild != null) { // has children
                              boolean isEdge = false;
                              if (_firstInsertion == null) { // init
                                  _firstInsertion = firstChild;
                  Severity: Minor
                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 afterCompose has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public void afterCompose() {
                          if (!_afterComposed) { // don't do it twice, if it has a child.
                              _afterComposed = true;
                              if (isEffective() && _firstInsertion == null) {
                                  Component host = getShadowHostIfAny();
                  Severity: Minor
                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 beforeHostChildAdded has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public void beforeHostChildAdded(Component child, Component insertBefore, int indexOfInsertBefore) {
                          if (log.isDebugEnabled()) {
                              log.debug("beforeHostChildAdded " + child + ", " + insertBefore + ", in this shadow "
                                      + ShadowElementsCtrl.getCurrentInfo());
                          }
                  Severity: Minor
                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 1 hr to fix

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

                            public void adjustCursor(Integer result) {
                                final int queryResult = result.intValue();
                                if (queryResult < 0) { // not found, find next
                                    if (_mid <= _low) {
                                        _low = _midChild + 1; // not found and do it from right again.
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 beforeChildAdded has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public void beforeChildAdded(Component child, Component refChild) {
                            if (!(child instanceof ShadowElement))
                                throw new UiException("Unsupported child for shadow element: " + child);
                            if (refChild != null && !(refChild instanceof ShadowElement))
                                throw new UiException("Unsupported refChild for shadow element: " + refChild);
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 1 hr to fix

                      Method adjustInsertionForInsertBefore has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private boolean adjustInsertionForInsertBefore(HtmlShadowElement se, Component target, Component insertBefore) {
                              Component old = null;
                              Direction direction = inRange(se, insertBefore);
                              switch (direction) {
                              case PREVIOUS:
                      Severity: Minor
                      Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 1 hr to fix

                        Method inRange has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static Direction inRange(HtmlShadowElement se, Component target) {
                                Component hostIfAny = se.getShadowHostIfAny();
                                Map<Component, Integer> oldCacheMap = se.getIndexCacheMap(hostIfAny);
                                final boolean destroyCacheMap = oldCacheMap == null;
                                try {
                        Severity: Minor
                        Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 1 hr to fix

                          Method shrinkRange has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected void shrinkRange(Component firstChild, Component lastChild) {
                                  if (firstChild != null) { // has children
                                      boolean isEdge = false;
                                      if (firstChild == _firstInsertion) { // cut edge
                                          if (lastChild == _lastInsertion) { // cut all
                          Severity: Minor
                          Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 getPreviousInsertionComponentIfAny has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public Component getPreviousInsertionComponentIfAny() {
                                  if (_previousInsertion == null) {
                                      Component result = _firstInsertion == null ? null : _firstInsertion.getNextSibling();
                                      if (result == null && getParent() != null) // ask for its parent
                                          return asShadow(getParent()).getPreviousInsertionComponentIfAny();
                          Severity: Minor
                          Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 getNextInsertionComponentIfAny has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public Component getNextInsertionComponentIfAny() {
                                  if (_nextInsertion == null) {
                                      Component result = _lastInsertion == null ? null : _lastInsertion.getNextSibling();
                                      if (result == null && getParent() != null) { // ask for its parent
                                          return asShadow(getParent()).getNextInsertionComponentIfAny();
                          Severity: Minor
                          Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 getIndex has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static int getIndex(ShadowElement owner, Component insertion, Map<Component, Integer> cacheMap) {
                                  if (insertion == null)
                                      return -1;
                                  if (insertion.getParent() == null) {
                                      if (owner == null) {
                          Severity: Minor
                          Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 1 hr to fix

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

                                protected void initClone(AbstractComponent cloneHost) {
                                    if (_previousInsertion != null) {
                                        if (_previousInsertion instanceof ShadowElement) {
                                            _previousInsertion = (Component) cloneHost.getShadowRoots().get(((ComponentCtrl) _host).getShadowRoots().indexOf(_previousInsertion));
                                        } else {
                            Severity: Minor
                            Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 fillUpIndexMap has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private Map<Component, Integer> fillUpIndexMap(Component first, Component last) {
                                    if (first == null) // last will be null too 
                                        return getIndexMap(getShadowHostIfAny());
                                    Component parent = first.getParent();
                                    if (parent == null)
                            Severity: Minor
                            Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 1 hr to fix

                              Method binarySearchSubTree has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private Object binarySearchSubTree(HtmlShadowElement subTree, int queryIndex, Map<Component, Integer> indexMap) {
                                      int startIndex, endIndex;
                                      if (subTree._firstInsertion == null) {
                                          return -1; // skip this;
                                      } else if ((startIndex = indexMap.get(subTree._firstInsertion)) > queryIndex) {
                              Severity: Minor
                              Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 55 mins to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

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

                                  @Override
                                  protected void updateSubBindingAnnotationCount(int diff) {
                                      for (AbstractComponent node = this; node != null;) {
                                          setSubBindingAnnotationCount(diff, node);
                                          AbstractComponent p = (AbstractComponent) node.getParent();
                              Severity: Minor
                              Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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

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

                                  private void setParent0(Component parent) {
                                      if (_host != null && parent != null) {
                                          throw new UiException("As a shadow root cannot be a child of a shadow element.");
                                      }
                              
                              Severity: Minor
                              Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 isDynamicValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  protected boolean isDynamicValue(String propName) {
                                      final ComponentCtrl compCtrl = this;
                                      Collection<Annotation> annos = compCtrl.getAnnotations(propName);
                                      if (!annos.isEmpty()) {
                                          for (Annotation anno : annos) {
                              Severity: Minor
                              Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 mergeToHost has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public boolean mergeToHost(Component host) {
                                      if (host == null)
                                          throw new UiException("The host cannot be null.");
                                      if (host == _host)
                                          return false; // nothing to do
                              Severity: Minor
                              Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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

                              Avoid too many return statements within this method.
                              Open

                                                      return true;
                              Severity: Major
                              Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                            return false;
                                Severity: Major
                                Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                  return Direction.IN_RANGE;
                                  Severity: Major
                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                return node.getShadowVariable(name, recurse);
                                    Severity: Major
                                    Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                              return matched;
                                      Severity: Major
                                      Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                        return Direction.LAST;
                                        Severity: Major
                                        Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                          return Direction.NEXT;
                                          Severity: Major
                                          Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                        return false;
                                            Severity: Major
                                            Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                              return Direction.PREVIOUS;
                                              Severity: Major
                                              Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                                return result; // node is found.
                                                Severity: Major
                                                Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                                  return; // finish
                                                  Severity: Major
                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                    return targetIndex - prev > 0 ? Direction.AFTER_NEXT : Direction.BEFORE_PREVIOUS;
                                                    Severity: Major
                                                    Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                              return _previousInsertion;
                                                      Severity: Major
                                                      Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                return subTree; // subTree is the intersection node.
                                                        Severity: Major
                                                        Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                  return null;
                                                          Severity: Major
                                                          Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                    return _nextInsertion;
                                                            Severity: Major
                                                            Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                              return Direction.FIRST;
                                                              Severity: Major
                                                              Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                                return; // finish
                                                                Severity: Major
                                                                Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 30 mins to fix

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

                                                                      public void beforeParentChanged(Component parent) {
                                                                          if (parent != null) {
                                                                              if (!(parent instanceof ShadowElement))
                                                                                  throw new UiException("Unsupported parent for shadow element: " + parent);
                                                                              if (_host != null) {
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 resolveVariable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                  Open

                                                                      public Object resolveVariable(Component child, String name, boolean recurse) {
                                                                          if (_firstInsertion == null) // out of our range;
                                                                              return null;
                                                                  
                                                                          if (child == null || child.getParent() == null) {
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 onHostDetached has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                  Open

                                                                      protected void onHostDetached(Component host) {
                                                                          if (host instanceof ComponentCtrl) {
                                                                              if (((ComponentCtrl) host).getShadowRoots().isEmpty()) {
                                                                                  Iterable<EventListener<? extends Event>> eventListeners = host
                                                                                          .getEventListeners(ON_REBUILD_SHADOW_TREE_LATER);
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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

                                                                          case NEXT:
                                                                              old = se._nextInsertion;
                                                                              if (old != null) {
                                                                                  HtmlShadowElement nextSibling = asShadow(se.getNextSibling());
                                                                                  if (nextSibling != null) { // se is not the last shadow element
                                                                  Severity: Major
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java and 1 other location - About 2 hrs to fix
                                                                  zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java on lines 1072..1097

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

                                                                  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

                                                                          case PREVIOUS:
                                                                              old = se._previousInsertion;
                                                                              if (old != null) {
                                                                                  HtmlShadowElement previousSibling = asShadow(se.getPreviousSibling());
                                                                                  if (previousSibling != null) { // se is not the first shadow element
                                                                  Severity: Major
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java and 1 other location - About 2 hrs to fix
                                                                  zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java on lines 1098..1123

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

                                                                  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 (_nextInsertion != null) {
                                                                              if (_nextInsertion instanceof ShadowElement) {
                                                                                  _nextInsertion = (Component) cloneHost.getShadowRoots().get(((ComponentCtrl) _host).getShadowRoots().indexOf(_nextInsertion));
                                                                              } else {
                                                                                  _nextInsertion = cloneHost.getChildren().get(_host.getChildren().indexOf(_nextInsertion));
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java and 1 other location - About 55 mins to fix
                                                                  zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java on lines 577..583

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

                                                                  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 (_previousInsertion != null) {
                                                                              if (_previousInsertion instanceof ShadowElement) {
                                                                                  _previousInsertion = (Component) cloneHost.getShadowRoots().get(((ComponentCtrl) _host).getShadowRoots().indexOf(_previousInsertion));
                                                                              } else {
                                                                                  _previousInsertion = cloneHost.getChildren().get(_host.getChildren().indexOf(_previousInsertion));
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java and 1 other location - About 55 mins to fix
                                                                  zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java on lines 593..599

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

                                                                  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

                                                                          case NEXT:
                                                                              old = se._nextInsertion;
                                                                              se._nextInsertion = target;
                                                                              if (old instanceof HtmlShadowElement) {
                                                                                  asShadow(old)._previousInsertion = target;
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java and 1 other location - About 40 mins to fix
                                                                  zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java on lines 1151..1157

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

                                                                  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

                                                                          case PREVIOUS:
                                                                              old = se._previousInsertion;
                                                                              se._previousInsertion = target;
                                                                              if (old instanceof HtmlShadowElement) {
                                                                                  asShadow(old)._nextInsertion = target;
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java and 1 other location - About 40 mins to fix
                                                                  zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java on lines 1158..1164

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

                                                                  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 next() {
                                                                              if (_j >= nDChild())
                                                                                  throw new java.util.NoSuchElementException();
                                                                              checkComodification();
                                                                  
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java and 1 other location - About 35 mins to fix
                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 3290..3299

                                                                  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

                                                                                  if (next != null && !(next instanceof HtmlShadowElement)) {
                                                                                      Component newNext = child._nextInsertion;
                                                                                      setPrevInsertion(newNext, next);
                                                                                      setPrevInsertion(next, child);
                                                                                  }
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java and 1 other location - About 35 mins to fix
                                                                  zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java on lines 683..687

                                                                  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

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

                                                                                  if (previous != null && !(previous instanceof HtmlShadowElement)) {
                                                                                      Component newPrevious = child._previousInsertion;
                                                                                      setPrevInsertion(previous, newPrevious);
                                                                                      setPrevInsertion(child, previous);
                                                                                  }
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java and 1 other location - About 35 mins to fix
                                                                  zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java on lines 688..692

                                                                  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

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

                                                                              if (node != null) {
                                                                                  try {
                                                                                      ShadowElementsCtrl.setCurrentInfo(node);
                                                                                      asShadow(node).beforeHostChildRemoved(child, indexOfChild);
                                                                                  } finally {
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java and 1 other location - About 35 mins to fix
                                                                  zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java on lines 1359..1366

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

                                                                  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

                                                                              else {
                                                                                  final ShadowElement se = this;
                                                                                  ((ComponentCtrl) prevhost).addCallback(AFTER_PAGE_DETACHED, new Callback<Component>() {
                                                                                      public void call(Component host) {
                                                                                          host.getDesktop().getWebApp().getConfiguration().afterShadowDetached(se, host);
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java and 1 other location - About 35 mins to fix
                                                                  zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java on lines 301..308

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

                                                                  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

                                                                              if (node != null) {
                                                                                  try {
                                                                                      ShadowElementsCtrl.setCurrentInfo(node);
                                                                                      asShadow(node).afterHostChildAdded(child, indexOfChild);
                                                                                  } finally {
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java and 1 other location - About 35 mins to fix
                                                                  zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java on lines 875..882

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

                                                                  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

                                                                          } else {
                                                                              final ShadowElement se = this;
                                                                              ((ComponentCtrl) host).addCallback(AFTER_PAGE_ATTACHED, new Callback<Component>() {
                                                                                  public void call(Component host) {
                                                                                      host.getDesktop().getWebApp().getConfiguration().afterShadowAttached(se, host);
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java and 1 other location - About 35 mins to fix
                                                                  zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java on lines 326..333

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

                                                                  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 updatePreviousInsertion(Component newPreviousInsertion) {
                                                                          if (_previousInsertion == newPreviousInsertion)
                                                                              return; // do nothing
                                                                  
                                                                          _previousInsertion = newPreviousInsertion;
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java and 1 other location - About 30 mins to fix
                                                                  zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java on lines 203..212

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

                                                                  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 updateNextInsertion(Component newNextInsertion) {
                                                                          if (_nextInsertion == newNextInsertion)
                                                                              return; // do nothing
                                                                  
                                                                          _nextInsertion = newNextInsertion;
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java and 1 other location - About 30 mins to fix
                                                                  zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java on lines 180..189

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

                                                                  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

                                                                          } else if (_nextInsertion instanceof HtmlShadowElement) {
                                                                              HtmlShadowElement nextInsertion = asShadow(_nextInsertion);
                                                                              // ask for the firstInsertion first.
                                                                              if (nextInsertion._firstInsertion != null)
                                                                                  return nextInsertion._firstInsertion;
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java and 1 other location - About 30 mins to fix
                                                                  zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java on lines 113..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 40.

                                                                  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

                                                                          } else if (_previousInsertion instanceof HtmlShadowElement) {
                                                                              HtmlShadowElement previousInsertion = asShadow(_previousInsertion);
                                                                              // ask for the lastInsertion first.
                                                                              if (previousInsertion._lastInsertion != null)
                                                                                  return previousInsertion._lastInsertion;
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java and 1 other location - About 30 mins to fix
                                                                  zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java on lines 94..100

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

                                                                  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

                                                                              if (index < 0 || index > (nChild = nDChild()))
                                                                                  throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + nDChild());
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java and 1 other location - About 30 mins to fix
                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 3270..3271

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

                                                                  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