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

Summary

Maintainability
F
1 mo
Test Coverage

File AbstractComponent.java has 2933 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* AbstractComponent.java

    Purpose:

    Description:
Severity: Major
Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 1 wk to fix

    AbstractComponent has 263 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class AbstractComponent implements Component, ComponentCtrl, java.io.Serializable {
        private static final Logger log = LoggerFactory.getLogger(AbstractComponent.class);
        private static final long serialVersionUID = 20100719L;
    
        /** Map(Class, Map(String name, Integer flags)). */
    Severity: Major
    Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 5 days to fix

      Method getShadowVariable0 has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
      Open

          protected Object getShadowVariable0(Component baseChild, String name, boolean recurse) {
              try {
                  _variableSeeking = true;
                  Object val = getAttribute(name);
                  if (val != null || hasAttribute(name))
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 1 day to fix

      Cognitive Complexity

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

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

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

      Further reading

      Method service has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
      Open

          /*package*/ void service(Event event, Scope scope, final List<EventListenerInfo> listeners,
                  final EventHandler evthd, final Method mtd, boolean skipPageListener) throws Exception {
              final Execution exec = Executions.getCurrent();
              final Desktop desktop = exec.getDesktop();
              final Page page = _page != null ? _page : desktop.getFirstPage();
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 addEventListener has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
      Open

          public boolean addEventListener(int priority, String evtnm, EventListener<? extends Event> listener) {
              if (evtnm == null || listener == null)
                  throw new IllegalArgumentException("null");
              if (!Events.isValid(evtnm))
                  throw new IllegalArgumentException("Invalid event name: " + evtnm);
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 removeEventListener has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

          public boolean removeEventListener(String evtnm, EventListener<? extends Event> listener) {
              if (evtnm == null || listener == null)
                  throw new IllegalArgumentException("null");
      
              if (_auxinf != null && _auxinf.listeners != null) {
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 setId has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

          public void setId(String id) {
              if (id == null)
                  id = "";
              if (!id.equals(_id)) {
                  final boolean rawId = this instanceof RawId;
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 readObject has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
              s.defaultReadObject();
      
              //read definition
              Object def = s.readObject();
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 renderProperties has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          protected void renderProperties(ContentRenderer renderer) throws IOException {
              _initialized = true;
              render(renderer, "id", _id);
              if (_auxinf != null && !_auxinf.visible) //don't call isVisible since it might be overriden (backward compatible)
                  renderer.render("visible", false);
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 getAttributes has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public Map<String, Object> getAttributes(int scope) {
              switch (scope) {
              case SPACE_SCOPE:
                  if (this instanceof IdSpace)
                      return getAttributes();
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 redraw has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public void redraw(final Writer out) throws IOException {
              final int order = ComponentRedraws.beforeRedraw(false);
              final boolean aupg = isAsyncUpdate();
              final String extra;
              try {
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 setPageBefore has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public void setPageBefore(Page page, Component refRoot) {
              beforeComponentPageChanged(page);
              if (refRoot != null && (page == null || refRoot.getParent() != null || refRoot.getPage() != page))
                  refRoot = null;
              if (refRoot != null /*&& refRoot.getPage() == page (checked)*/
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 onEvent has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

              public void onEvent(Event event) {
                  final ForwardInfo info = _auxinf.forwards.get(_orgEvent);
                  if (info != null)
                      for (TargetInfo ti : new ArrayList<TargetInfo>(info.targets)) {
                          Component target = resolveForwardTarget(ti.target);
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 fixAttrValues has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          private Map<String, String[]> fixAttrValues(Map<?, ?> attrs) {
              if (attrs == null)
                  return null;
      
              for (Map.Entry<?, ?> m0 : attrs.entrySet()) {
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 getAttributeOrFellow has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          public Object getAttributeOrFellow(String name, boolean recurse) {
              Object val = getAttribute(name);
              if (val != null || hasAttribute(name))
                  return val;
      
      
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 redraw has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public void redraw(final Writer out) throws IOException {
              final int order = ComponentRedraws.beforeRedraw(false);
              final boolean aupg = isAsyncUpdate();
              final String extra;
              try {
      Severity: Major
      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 2 hrs to fix

        Method getShadowVariable0 has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected Object getShadowVariable0(Component baseChild, String name, boolean recurse) {
                try {
                    _variableSeeking = true;
                    Object val = getAttribute(name);
                    if (val != null || hasAttribute(name))
        Severity: Major
        Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 2 hrs to fix

          Method setPage0 has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              private void setPage0(Page page) {
                  if (page == _page)
                      return; //nothing changed
          
                  //assert _parent == null || _parent.getPage() == page;
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 setParent has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              public void setParent(Component parent) {
                  if (_parent == parent)
                      return; //nothing changed
          
                  checkParentChild(parent, this); //create _chdinf
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 replaceWith has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              private final void replaceWith(AbstractComponent comp, boolean bFellow, boolean bListener, boolean bChildren) {
                  if (this == comp || comp._parent != null || comp._next != null || comp._prev != null || comp._chdinf != null
                          || comp._page != null)
                      throw new IllegalStateException();
          
          
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 service has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              /*package*/ void service(Event event, Scope scope, final List<EventListenerInfo> listeners,
                      final EventHandler evthd, final Method mtd, boolean skipPageListener) throws Exception {
                  final Execution exec = Executions.getCurrent();
                  final Desktop desktop = exec.getDesktop();
                  final Page page = _page != null ? _page : desktop.getFirstPage();
          Severity: Major
          Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 2 hrs to fix

            Method addForward0 has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                private boolean addForward0(String orgEvent, Object target, String targetEvent, Object eventData) {
                    if (orgEvent == null)
                        orgEvent = "onClick";
                    else if (!Events.isValid(orgEvent))
                        throw new IllegalArgumentException("Illegal event name: " + orgEvent);
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 cloneListeners has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                    private void cloneListeners(AbstractComponent owner, AuxInfo clone) {
                        if (listeners != null) {
                            clone.listeners = new HashMap<String, List<EventListenerInfo>>(4);
                            for (Map.Entry<String, List<EventListenerInfo>> me : listeners.entrySet()) {
                                final List<EventListenerInfo> list = new LinkedList<EventListenerInfo>();
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 hasAttributeOrFellow has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                public boolean hasAttributeOrFellow(String name, boolean recurse) {
                    if (hasAttribute(name) || (this instanceof IdSpace && hasFellow(name)))
                        return true;
            
                    if (recurse) {
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 insertBefore has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                public boolean insertBefore(Component newChild, Component refChild) {
                    if ((newChild instanceof Macro) && ((Macro) newChild).isInline())
                        return ((Macro) newChild).setInlineParent(this, refChild);
            
                    checkParentChild(this, newChild); ///create _chdinf
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 setDefinition has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                public void setDefinition(String name) {
                    final Execution exec = Executions.getCurrent();
                    if (exec != null) {
                        final ExecutionCtrl execCtrl = (ExecutionCtrl) exec;
                        final PageDefinition pgdef = execCtrl.getCurrentPageDefinition();
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 setParent has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public void setParent(Component parent) {
                    if (_parent == parent)
                        return; //nothing changed
            
                    checkParentChild(parent, this); //create _chdinf
            Severity: Major
            Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 2 hrs to fix

              Method readObject has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
                      s.defaultReadObject();
              
                      //read definition
                      Object def = s.readObject();
              Severity: Major
              Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 2 hrs to fix

                Method sessionDidActivate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    public void sessionDidActivate(Page page) {
                        _page = page;
                
                        Set<Object> uniqueAttrs = new LinkedHashSet<Object>(); //ZK-2701: use set to record unique attrs and listeners
                        if (_auxinf != null && _auxinf.attrs != null) {
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 removeForward0 has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    private boolean removeForward0(String orgEvent, Object target, String targetEvent) {
                        if (_auxinf != null && _auxinf.forwards != null) {
                            final ForwardInfo info = _auxinf.forwards.get(orgEvent);
                            if (info != null) {
                                final List<TargetInfo> tis = info.targets;
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 insertBefore has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public boolean insertBefore(Component newChild, Component refChild) {
                        if ((newChild instanceof Macro) && ((Macro) newChild).isInline())
                            return ((Macro) newChild).setInlineParent(this, refChild);
                
                        checkParentChild(this, newChild); ///create _chdinf
                Severity: Major
                Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 2 hrs to fix

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

                      private synchronized void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
                          //No need to unshare annots and evthds, since stored as an independent copy
                  
                          s.defaultWriteObject();
                  
                  
                  Severity: Minor
                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 checkParentChild has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private static void checkParentChild(Component parent, Component child) throws UiException {
                          if (child == null)
                              throw new UiException("Child cannot be null");
                          if (parent != null) {
                              final AbstractComponent acp = (AbstractComponent) parent;
                  Severity: Minor
                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 addEventListener has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public boolean addEventListener(int priority, String evtnm, EventListener<? extends Event> listener) {
                          if (evtnm == null || listener == null)
                              throw new IllegalArgumentException("null");
                          if (!Events.isValid(evtnm))
                              throw new IllegalArgumentException("Invalid event name: " + evtnm);
                  Severity: Major
                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 2 hrs to fix

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

                        public void sessionWillPassivate(Page page) {
                            Set<Object> uniqueAttrs = new LinkedHashSet<Object>(); //ZK-2701: use set to record unique attrs and listeners
                            if (_auxinf != null && _auxinf.attrs != null) {
                                uniqueAttrs.addAll(_auxinf.attrs.getAttributes().values());
                                willPassivate(uniqueAttrs); //ZK-2701: only passivate the same object once
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 isListenerAvailable has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public boolean isListenerAvailable(String evtnm, boolean asap) {
                            if (_auxinf != null && _auxinf.listeners != null) {
                                final List<EventListenerInfo> lis = _auxinf.listeners.get(evtnm);
                                if (lis != null) {
                                    if (!asap)
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 setAttribute has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public Object setAttribute(String name, Object value, boolean recurse) {
                            if (recurse && !hasAttribute(name)) {
                                if (_parent != null) {
                                    if (_parent.hasAttribute(name, true))
                                        return _parent.setAttribute(name, value, true);
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 removeAttribute has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public Object removeAttribute(String name, boolean recurse) {
                            if (recurse && !hasAttribute(name)) {
                                if (_parent != null) {
                                    if (_parent.hasAttribute(name, true))
                                        return _parent.removeAttribute(name, true);
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 replaceWith has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private final void replaceWith(AbstractComponent comp, boolean bFellow, boolean bListener, boolean bChildren) {
                            if (this == comp || comp._parent != null || comp._next != null || comp._prev != null || comp._chdinf != null
                                    || comp._page != null)
                                throw new IllegalStateException();
                    
                    
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 1 hr to fix

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

                          protected void renderProperties(ContentRenderer renderer) throws IOException {
                              _initialized = true;
                              render(renderer, "id", _id);
                              if (_auxinf != null && !_auxinf.visible) //don't call isVisible since it might be overriden (backward compatible)
                                  renderer.render("visible", false);
                      Severity: Minor
                      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 1 hr to fix

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

                            protected void updateByClient(String name, Object value) {
                                Object o = getAttribute("org.zkoss.zk.ui.updateByClient");
                                if (!(o instanceof Boolean && ((Boolean) o).booleanValue()) && !(o instanceof String && "true".equals(o))) {
                                    log.warn("Ignore update of " + name + "=" + value + " from client for " + this.getClass());
                                    return; //ignored
                        Severity: Minor
                        Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 clone has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public Object clone() {
                                final AbstractComponent clone;
                                try {
                                    clone = (AbstractComponent) super.clone();
                                } catch (CloneNotSupportedException e) {
                        Severity: Minor
                        Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 setId has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public void setId(String id) {
                                if (id == null)
                                    id = "";
                                if (!id.equals(_id)) {
                                    final boolean rawId = this instanceof RawId;
                        Severity: Minor
                        Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 1 hr to fix

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

                              protected void updateByClient(String name, Object value) {
                                  Object o = getAttribute("org.zkoss.zk.ui.updateByClient");
                                  if (!(o instanceof Boolean && ((Boolean) o).booleanValue()) && !(o instanceof String && "true".equals(o))) {
                                      log.warn("Ignore update of " + name + "=" + value + " from client for " + this.getClass());
                                      return; //ignored
                          Severity: Minor
                          Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 1 hr to fix

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

                                public String getUuid() {
                                    if (_uuid == null) {
                                        Execution exec = null; // ZK-2606: if parent has _page, child is in the same component tree
                                        for (Component comp = this; comp != null; comp = comp.getParent()) {
                                            if (comp.getPage() != null) {
                            Severity: Minor
                            Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 clone has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                                    public Object clone() {
                                        final AuxInfo clone;
                                        try {
                                            clone = (AuxInfo) super.clone();
                                        } catch (CloneNotSupportedException e) {
                            Severity: Minor
                            Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 writeObject has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private synchronized void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
                                    //No need to unshare annots and evthds, since stored as an independent copy
                            
                                    s.defaultWriteObject();
                            
                            
                            Severity: Minor
                            Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 1 hr to fix

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

                                  public Map<String, Object> getAttributes(int scope) {
                                      switch (scope) {
                                      case SPACE_SCOPE:
                                          if (this instanceof IdSpace)
                                              return getAttributes();
                              Severity: Minor
                              Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 1 hr to fix

                                Method addForward0 has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    private boolean addForward0(String orgEvent, Object target, String targetEvent, Object eventData) {
                                        if (orgEvent == null)
                                            orgEvent = "onClick";
                                        else if (!Events.isValid(orgEvent))
                                            throw new IllegalArgumentException("Illegal event name: " + orgEvent);
                                Severity: Minor
                                Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 1 hr to fix

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

                                      private void triggerBeforeHostChildRemoved(Component child) {
                                          if (isDisabledHostChanged()) return;
                                          List<ShadowElement> shadowRoots = getShadowRoots();
                                          if (!shadowRoots.isEmpty()) {
                                              Map<Component, Integer> indexCacheMap = getIndexCacheMap(this);
                                  Severity: Minor
                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 triggerAfterHostChildAdded has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      private void triggerAfterHostChildAdded(Component child) {
                                          if (isDisabledHostChanged()) return;
                                          List<ShadowElement> shadowRoots = getShadowRoots();
                                          if (!shadowRoots.isEmpty()) {
                                              Map<Component, Integer> indexCacheMap = getIndexCacheMap(this);
                                  Severity: Minor
                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 redrawChildren has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      protected void redrawChildren(Writer out) throws IOException {
                                          final Object xc = getExtraCtrl();
                                          if (xc instanceof Cropper) {
                                              final Set<? extends Component> crop = ((Cropper) xc).getAvailableAtClient();
                                              if (crop != null) {
                                  Severity: Minor
                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 triggerBeforeHostParentChanged has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      private void triggerBeforeHostParentChanged(Component parent) {
                                          if (isDisabledHostChanged()) return;
                                          List<ShadowElement> shadowRoots = getShadowRoots();
                                          if (!shadowRoots.isEmpty()) {
                                              Map<Component, Integer> indexCacheMap = getIndexCacheMap(this);
                                  Severity: Minor
                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 setPageBefore has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public void setPageBefore(Page page, Component refRoot) {
                                          beforeComponentPageChanged(page);
                                          if (refRoot != null && (page == null || refRoot.getParent() != null || refRoot.getPage() != page))
                                              refRoot = null;
                                          if (refRoot != null /*&& refRoot.getPage() == page (checked)*/
                                  Severity: Minor
                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 1 hr to fix

                                    Method removeEventListener has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public boolean removeEventListener(String evtnm, EventListener<? extends Event> listener) {
                                            if (evtnm == null || listener == null)
                                                throw new IllegalArgumentException("null");
                                    
                                            if (_auxinf != null && _auxinf.listeners != null) {
                                    Severity: Minor
                                    Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 1 hr to fix

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

                                          private void triggerAfterHostChildRemoved(Component child) {
                                              List<ShadowElement> shadowRoots = getShadowRoots();
                                              if (!shadowRoots.isEmpty()) {
                                                  Map<Component, Integer> indexCacheMap = getIndexCacheMap(this);
                                                  try {
                                      Severity: Minor
                                      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 addToShadowIdMap has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          private static void addToShadowIdMap(Component comp) {
                                              if (comp instanceof ShadowElementCtrl) {
                                                  Component host = ((ShadowElementCtrl) comp).getShadowHostIfAny();
                                                  if (host != null) {
                                                      String id = comp.getId();
                                      Severity: Minor
                                      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 onListenerChange has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          private void onListenerChange(Desktop desktop, boolean listen) {
                                              if (listen) {
                                                  if (Events.isListened(this, Events.ON_CLIENT_INFO, false)) { //asap+deferrable
                                                      response(new AuClientInfo(desktop));
                                                      getDesktop().setAttribute("org.zkoss.desktop.clientinfo.enabled", true);
                                      Severity: Minor
                                      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 addClientEvent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          protected static void addClientEvent(Class<? extends Component> cls, String evtnm, int flags) {
                                              Map<String, Integer> events = _clientEvents.get(cls);
                                      
                                              if (events == null) {
                                                  synchronized (cls.getClass()) {
                                      Severity: Minor
                                      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 initClone has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                              private void initClone(AbstractComponent owner, AuxInfo clone) {
                                                  //spaceinfo (after children is cloned)
                                                  if (spaceInfo != null) {
                                                      clone.spaceInfo = owner.new SpaceInfo();
                                                      owner.cloneSpaceInfoFrom(spaceInfo);
                                      Severity: Minor
                                      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 setPage0 has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          private void setPage0(Page page) {
                                              if (page == _page)
                                                  return; //nothing changed
                                      
                                              //assert _parent == null || _parent.getPage() == page;
                                      Severity: Minor
                                      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 1 hr to fix

                                        Method initClone has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                                private void initClone(AbstractComponent owner, AuxInfo clone) {
                                                    //spaceinfo (after children is cloned)
                                                    if (spaceInfo != null) {
                                                        clone.spaceInfo = owner.new SpaceInfo();
                                                        owner.cloneSpaceInfoFrom(spaceInfo);
                                        Severity: Minor
                                        Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 1 hr to fix

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

                                                  @SuppressWarnings("unchecked")
                                                  private void markARing(Component child, boolean set, int which) {
                                                      if (set) {
                                                          if (_aring == null)
                                                              _aring = new Set[2];
                                          Severity: Minor
                                          Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 checkIdSpaces has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              private static void checkIdSpaces(final AbstractComponent comp, String newId) {
                                                  if (comp instanceof NonFellow)
                                                      return; //no need to check
                                          
                                                  if (comp instanceof IdSpace && comp._auxinf.spaceInfo.fellows.containsKey(newId))
                                          Severity: Minor
                                          Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 triggerBeforeHostChildAdded has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              private void triggerBeforeHostChildAdded(Component child, Component insertBefore) {
                                                  if (isDisabledHostChanged()) return;
                                                  List<ShadowElement> shadowRoots = getShadowRoots();
                                                  if (!shadowRoots.isEmpty()) {
                                                      try {
                                          Severity: Minor
                                          Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 hasAttribute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              public boolean hasAttribute(String name, boolean recurse) {
                                                  if (hasAttribute(name))
                                                      return true;
                                          
                                                  if (recurse) {
                                          Severity: Minor
                                          Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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

                                          Avoid deeply nested control flow statements.
                                          Open

                                                                  if (lis.isEmpty())
                                                                      _auxinf.listeners.remove(evtnm);
                                          Severity: Major
                                          Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 45 mins to fix

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

                                                public String setWidgetOverride(String name, String script) {
                                                    if (name == null)
                                                        throw new IllegalArgumentException();
                                            
                                                    final String old;
                                            Severity: Minor
                                            Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 setMold has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                public void setMold(String mold) {
                                                    if (mold != null && (DEFAULT.equals(mold) || mold.length() == 0))
                                                        mold = null;
                                                    if (!Objects.equals(_auxinf != null ? _auxinf.mold : DEFAULT, mold)) {
                                                        if (!_def.hasMold(mold != null ? mold : DEFAULT))
                                            Severity: Minor
                                            Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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

                                            Avoid deeply nested control flow statements.
                                            Open

                                                                        if (shadowHost.getParent() != null) {
                                                                            return ((AbstractComponent) shadowHost.getParent()).getShadowVariable0(shadowHost, name,
                                                                                    recurse);
                                                                        }
                                            Severity: Major
                                            Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                                      if (li.priority == priority)
                                                                          return false; //nothing to do
                                              Severity: Major
                                              Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 45 mins to fix

                                                Avoid deeply nested control flow statements.
                                                Open

                                                                        if (tis.isEmpty()) { //no more event
                                                                            _auxinf.forwards.remove(orgEvent);
                                                                            removeEventListener(orgEvent, info.listener);
                                                                        }
                                                Severity: Major
                                                Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 45 mins to fix

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                                              if (val == null)
                                                                                  continue; //don't use it in clone
                                                  Severity: Major
                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 45 mins to fix

                                                    Method service has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                    Open

                                                        /*package*/ void service(Event event, Scope scope, final List<EventListenerInfo> listeners,
                                                                final EventHandler evthd, final Method mtd, boolean skipPageListener) throws Exception {
                                                    Severity: Minor
                                                    Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 45 mins to fix

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

                                                          public String setWidgetListener(String evtnm, String script) {
                                                              if (evtnm == null)
                                                                  throw new IllegalArgumentException();
                                                      
                                                              final String old;
                                                      Severity: Minor
                                                      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 checkIdSpacesDown has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                          private static void checkIdSpacesDown(Component comp, IdSpace owner) {
                                                              final String compId = comp.getId();
                                                              if (!(comp instanceof NonFellow) && !isAutoId(compId)
                                                                      && (owner instanceof Component
                                                                              ? ((AbstractComponent) owner)._auxinf.spaceInfo.fellows.containsKey(compId)
                                                      Severity: Minor
                                                      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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

                                                      Avoid deeply nested control flow statements.
                                                      Open

                                                                              if (desktop != null) {
                                                                                  onListenerChange(desktop, false);
                                                      
                                                                                  if (getClientEvents().containsKey(evtnm)) {
                                                                                      if (lis.isEmpty() && !Events.isListened(this, evtnm, false))
                                                      Severity: Major
                                                      Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 45 mins to fix

                                                        Consider simplifying this complex logical expression.
                                                        Open

                                                                if (this == comp || comp._parent != null || comp._next != null || comp._prev != null || comp._chdinf != null
                                                                        || comp._page != null)
                                                                    throw new IllegalStateException();
                                                        Severity: Major
                                                        Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 40 mins to fix

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

                                                              private void afterComponentPageChanged(Page newpg, Page oldpg) {
                                                                  if (newpg == oldpg) {
                                                                      // Orphan case: detached again after the parent was detached
                                                                      if (getParent() == null && oldpg == null) {
                                                                          WebApps.getCurrent().getConfiguration().afterComponentDetached(this, null);
                                                          Severity: Minor
                                                          Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 addSharedEventHandlerMap has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                          Open

                                                              public void addSharedEventHandlerMap(EventHandlerMap evthds) {
                                                                  if (evthds != null && !evthds.isEmpty()) {
                                                                      unshareEventHandlerMap(false);
                                                                      if (initAuxInfo().evthds == null) {
                                                                          _auxinf.evthds = evthds;
                                                          Severity: Minor
                                                          Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 getAttribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                          Open

                                                              public Object getAttribute(String name, boolean recurse) {
                                                                  Object val = getAttribute(name);
                                                                  if (val != null || !recurse || hasAttribute(name))
                                                                      return val;
                                                          
                                                          
                                                          Severity: Minor
                                                          Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 findNearestShadow has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                          Open

                                                              private HtmlShadowElement findNearestShadow(HtmlShadowElement current, Component baseChild) {
                                                                  List<ShadowElement> list = cast(current.getChildren());
                                                                  for (ShadowElement sh : list) {
                                                                      if (sh instanceof HtmlShadowElement) {
                                                                          HtmlShadowElement shadow0 = (HtmlShadowElement) sh;
                                                          Severity: Minor
                                                          Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 setTemplate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                          Open

                                                              public Template setTemplate(String name, Template template) {
                                                                  if (template == null) {
                                                                      return _auxinf != null && _auxinf.templates != null ? _auxinf.templates.remove(name) : null;
                                                                  } else {
                                                                      AuxInfo auxinf = initAuxInfo();
                                                          Severity: Minor
                                                          Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 setClientAttribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                          Open

                                                              public String setClientAttribute(String name, String value) {
                                                                  if (name == null)
                                                                      throw new IllegalArgumentException();
                                                          
                                                                  final String old;
                                                          Severity: Minor
                                                          Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 _page.getDesktop().getSession().getAttributes();
                                                          Severity: Major
                                                          Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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/AbstractComponent.java - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                              return getVirtualIdSpace().hasFellow(name);
                                                              Severity: Major
                                                              Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                                return _page.getDesktop().getWebApp().getAttributes();
                                                                Severity: Major
                                                                Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                              return Collections.emptyMap();
                                                                  Severity: Major
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                                        return _parent.getShadowVariable0(this, name, recurse);
                                                                    Severity: Major
                                                                    Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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/AbstractComponent.java - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

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

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                      return Collections.emptyMap();
                                                                          Severity: Major
                                                                          Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 30 mins to fix

                                                                            Avoid too many return statements within this method.
                                                                            Open

                                                                                            return _page.getDesktop().getAttributes();
                                                                            Severity: Major
                                                                            Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 30 mins to fix

                                                                              Avoid too many return statements within this method.
                                                                              Open

                                                                                          return Collections.emptyMap();
                                                                              Severity: Major
                                                                              Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 30 mins to fix

                                                                                Avoid too many return statements within this method.
                                                                                Open

                                                                                                    return shadowHost.getAttributeOrFellow(name, true);
                                                                                Severity: Major
                                                                                Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 30 mins to fix

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

                                                                                              return Collections.emptyMap();
                                                                                  Severity: Major
                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 30 mins to fix

                                                                                    Avoid too many return statements within this method.
                                                                                    Open

                                                                                                    return getVirtualIdSpace().getFellowIfAny(name);
                                                                                    Severity: Major
                                                                                    Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 30 mins to fix

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

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

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

                                                                                                    return Collections.emptyMap();
                                                                                        Severity: Major
                                                                                        Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 30 mins to fix

                                                                                          Avoid too many return statements within this method.
                                                                                          Open

                                                                                                                          return ((AbstractComponent) shadowHost.getParent()).getShadowVariable0(shadowHost, name,
                                                                                                                                  recurse);
                                                                                          Severity: Major
                                                                                          Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 30 mins to fix

                                                                                            Avoid too many return statements within this method.
                                                                                            Open

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

                                                                                              Avoid too many return statements within this method.
                                                                                              Open

                                                                                                              return exec.getAttributes();
                                                                                              Severity: Major
                                                                                              Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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/AbstractComponent.java - About 30 mins to fix

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

                                                                                                      private static IdSpace spaceOwner(Component p, boolean ignoreVirtualIS) {
                                                                                                          Component top;
                                                                                                          do {
                                                                                                              if (p instanceof IdSpace)
                                                                                                                  return (IdSpace) p;
                                                                                                  Severity: Minor
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 addToIdSpacesDown has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                  Open

                                                                                                      private static void addToIdSpacesDown(Component comp, IdSpace owner) {
                                                                                                          if (!(comp instanceof NonFellow) && !isAutoId(comp.getId()))
                                                                                                              addFellow(comp, owner);
                                                                                                  
                                                                                                          if (!(comp instanceof IdSpace))
                                                                                                  Severity: Minor
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 getFellowIfAny has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                  Open

                                                                                                      public Component getFellowIfAny(String compId, boolean recurse) {
                                                                                                          if (!recurse)
                                                                                                              return getFellowIfAny(compId);
                                                                                                  
                                                                                                          for (IdSpace idspace = getSpaceOwner(); idspace != null;) {
                                                                                                  Severity: Minor
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 addShadowRoot has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                  Open

                                                                                                      public boolean addShadowRoot(ShadowElement shadow) {
                                                                                                          if (shadow == null) {
                                                                                                              throw new IllegalArgumentException("Shadow element cannot be null!");
                                                                                                          }
                                                                                                          if (shadow.getShadowHost() == null) {
                                                                                                  Severity: Minor
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 removeFromIdSpacesDown has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                  Open

                                                                                                      private static void removeFromIdSpacesDown(Component comp, IdSpace owner) {
                                                                                                          if (!(comp instanceof NonFellow) && !isAutoId(comp.getId()))
                                                                                                              removeFellow(comp, owner);
                                                                                                  
                                                                                                          if (!(comp instanceof IdSpace))
                                                                                                  Severity: Minor
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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

                                                                                                      public String setWidgetListener(String evtnm, String script) {
                                                                                                          if (evtnm == null)
                                                                                                              throw new IllegalArgumentException();
                                                                                                  
                                                                                                          final String old;
                                                                                                  Severity: Major
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 2 hrs to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 811..825

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

                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                  Refactorings

                                                                                                  Further Reading

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

                                                                                                      public String setWidgetOverride(String name, String script) {
                                                                                                          if (name == null)
                                                                                                              throw new IllegalArgumentException();
                                                                                                  
                                                                                                          final String old;
                                                                                                  Severity: Major
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 2 hrs to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 785..799

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

                                                                                                  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

                                                                                                      private void triggerBeforeHostChildRemoved(Component child) {
                                                                                                          if (isDisabledHostChanged()) return;
                                                                                                          List<ShadowElement> shadowRoots = getShadowRoots();
                                                                                                          if (!shadowRoots.isEmpty()) {
                                                                                                              Map<Component, Integer> indexCacheMap = getIndexCacheMap(this);
                                                                                                  Severity: Major
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 1 hr to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 4150..4171

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

                                                                                                  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

                                                                                                      private void triggerAfterHostChildAdded(Component child) {
                                                                                                          if (isDisabledHostChanged()) return;
                                                                                                          List<ShadowElement> shadowRoots = getShadowRoots();
                                                                                                          if (!shadowRoots.isEmpty()) {
                                                                                                              Map<Component, Integer> indexCacheMap = getIndexCacheMap(this);
                                                                                                  Severity: Major
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 1 hr to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 4086..4107

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

                                                                                                  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 (recurse) {
                                                                                                              if (_parent != null)
                                                                                                                  return _parent.getAttributeOrFellow(name, true);
                                                                                                              if (_page != null)
                                                                                                                  return _page.getAttributeOrFellow(name, true);
                                                                                                  Severity: Major
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 1 hr to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 1174..1186

                                                                                                  Duplicated Code

                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                  Tuning

                                                                                                  This issue has a mass of 100.

                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                  Refactorings

                                                                                                  Further Reading

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

                                                                                                          if (recurse) {
                                                                                                              if (_parent != null)
                                                                                                                  return _parent.hasAttributeOrFellow(name, true);
                                                                                                              if (_page != null)
                                                                                                                  return _page.hasAttributeOrFellow(name, true);
                                                                                                  Severity: Major
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 1 hr to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 1048..1060

                                                                                                  Duplicated Code

                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                  Tuning

                                                                                                  This issue has a mass of 100.

                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                  Refactorings

                                                                                                  Further Reading

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

                                                                                                      public Object setAttribute(String name, Object value, boolean recurse) {
                                                                                                          if (recurse && !hasAttribute(name)) {
                                                                                                              if (_parent != null) {
                                                                                                                  if (_parent.hasAttribute(name, true))
                                                                                                                      return _parent.setAttribute(name, value, true);
                                                                                                  Severity: Major
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 1 hr to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/impl/DesktopImpl.java on lines 735..746

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

                                                                                                  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 (!shadowRoots.isEmpty()) {
                                                                                                              Map<Component, Integer> indexCacheMap = getIndexCacheMap(this);
                                                                                                              try {
                                                                                                                  if (indexCacheMap == null) {
                                                                                                                      initIndexCacheMap(this);
                                                                                                  Severity: Major
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 1 hr to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 4111..4127

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

                                                                                                  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 (!shadowRoots.isEmpty()) {
                                                                                                              Map<Component, Integer> indexCacheMap = getIndexCacheMap(this);
                                                                                                              try {
                                                                                                                  if (indexCacheMap == null) {
                                                                                                                      initIndexCacheMap(this);
                                                                                                  Severity: Major
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 1 hr to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 4067..4083

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

                                                                                                  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

                                                                                                      public Object removeAttribute(String name, boolean recurse) {
                                                                                                          if (recurse && !hasAttribute(name)) {
                                                                                                              if (_parent != null) {
                                                                                                                  if (_parent.hasAttribute(name, true))
                                                                                                                      return _parent.removeAttribute(name, true);
                                                                                                  Severity: Major
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 1 hr to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/impl/DesktopImpl.java on lines 752..764

                                                                                                  Duplicated Code

                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                  Tuning

                                                                                                  This issue has a mass of 89.

                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                  Refactorings

                                                                                                  Further Reading

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

                                                                                                      public Object getAttribute(String name, boolean recurse) {
                                                                                                          Object val = getAttribute(name);
                                                                                                          if (val != null || !recurse || hasAttribute(name))
                                                                                                              return val;
                                                                                                  
                                                                                                  
                                                                                                  Severity: Major
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 1 hr to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/impl/DesktopImpl.java on lines 704..713

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

                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                  Refactorings

                                                                                                  Further Reading

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

                                                                                                      public static class TargetInfo implements java.io.Serializable {
                                                                                                          private final Object target;
                                                                                                          private final String event;
                                                                                                          private Object data;
                                                                                                  
                                                                                                  
                                                                                                  Severity: Major
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 3 other locations - About 1 hr to fix
                                                                                                  zktest/src/main/java/org/zkoss/zktest/test2/B65_ZK_1998Composer.java on lines 104..127
                                                                                                  zktest/src/main/java/org/zkoss/zktest/test2/B85_ZK_3656VM.java on lines 54..78
                                                                                                  zktest/src/main/java/org/zkoss/zktest/test2/F86_ZK_4028Item.java on lines 19..41

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

                                                                                                  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

                                                                                                      private void unshareEventHandlerMap(boolean autocreate) {
                                                                                                          if (_auxinf != null && _auxinf.evthdsShared) {
                                                                                                              _auxinf.evthds = (EventHandlerMap) _auxinf.evthds.clone();
                                                                                                              _auxinf.evthdsShared = false;
                                                                                                          } else if (autocreate && initAuxInfo().evthds == null) {
                                                                                                  Severity: Major
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 1 hr to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 2878..2885

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

                                                                                                  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

                                                                                                      private void unshareAnnotationMap(boolean autocreate) {
                                                                                                          if (_auxinf != null && _auxinf.annotsShared) {
                                                                                                              _auxinf.annots = (AnnotationMap) _auxinf.annots.clone();
                                                                                                              _auxinf.annotsShared = false;
                                                                                                          } else if (autocreate && initAuxInfo().annots == null) {
                                                                                                  Severity: Major
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 1 hr to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 2784..2791

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

                                                                                                  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

                                                                                                      public boolean hasAttribute(String name, boolean recurse) {
                                                                                                          if (hasAttribute(name))
                                                                                                              return true;
                                                                                                  
                                                                                                          if (recurse) {
                                                                                                  Severity: Minor
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 50 mins to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/impl/DesktopImpl.java on lines 719..729

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

                                                                                                  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

                                                                                                      private static void addToIdSpaces(final Component comp) {
                                                                                                          final String compId = comp.getId();
                                                                                                          if (comp instanceof NonFellow || isAutoId(compId))
                                                                                                              return; //nothing to do
                                                                                                  
                                                                                                  
                                                                                                  Severity: Minor
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 45 mins to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 264..273

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

                                                                                                  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

                                                                                                      private static void removeFromIdSpaces(final Component comp) {
                                                                                                          final String compId = comp.getId();
                                                                                                          if (comp instanceof NonFellow || isAutoId(compId))
                                                                                                              return; //nothing to do
                                                                                                  
                                                                                                  
                                                                                                  Severity: Minor
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 45 mins to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 227..236

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

                                                                                                  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 (curInfo instanceof ComponentInfo) {
                                                                                                                  final ComponentInfo compInfo = (ComponentInfo) curInfo;
                                                                                                                  _def = compInfo.getComponentDefinition();
                                                                                                                  addSharedAnnotationMap(_def.getAnnotationMap());
                                                                                                                  addSharedAnnotationMap(compInfo.getAnnotationMap());
                                                                                                  Severity: Minor
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 40 mins to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 170..178

                                                                                                  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

                                                                                                              } else if (curInfo instanceof ShadowInfo) {
                                                                                                                  final ShadowInfo compInfo = (ShadowInfo) curInfo;
                                                                                                                  _def = compInfo.getComponentDefinition();
                                                                                                                  addSharedAnnotationMap(_def.getAnnotationMap());
                                                                                                                  addSharedAnnotationMap(compInfo.getAnnotationMap());
                                                                                                  Severity: Minor
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 40 mins to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 162..170

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

                                                                                                  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

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

                                                                                                          if (!(comp instanceof IdSpace))
                                                                                                              for (AbstractComponent ac = (AbstractComponent) comp.getFirstChild(); ac != null; ac = ac._next)
                                                                                                                  addToIdSpacesDown(ac, owner); //recursive
                                                                                                  Severity: Minor
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 2 other locations - About 35 mins to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 331..333
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 354..356

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

                                                                                                          if (!(comp instanceof IdSpace))
                                                                                                              for (AbstractComponent ac = (AbstractComponent) comp.getFirstChild(); ac != null; ac = ac._next)
                                                                                                                  checkIdSpacesDown(ac, owner); //recursive
                                                                                                  Severity: Minor
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 2 other locations - About 35 mins to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 308..310
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 331..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

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

                                                                                                              if (initAuxInfo().annots == null) {
                                                                                                                  _auxinf.annots = annots;
                                                                                                                  _auxinf.annotsShared = true;
                                                                                                              } else {
                                                                                                                  _auxinf.annots.addAll(annots);
                                                                                                  Severity: Minor
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 35 mins to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 2736..2741

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

                                                                                                          if (!(comp instanceof IdSpace))
                                                                                                              for (AbstractComponent ac = (AbstractComponent) comp.getFirstChild(); ac != null; ac = ac._next)
                                                                                                                  removeFromIdSpacesDown(ac, owner); //recursive
                                                                                                  Severity: Minor
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 2 other locations - About 35 mins to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 308..310
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 354..356

                                                                                                  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

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

                                                                                                              if (initAuxInfo().evthds == null) {
                                                                                                                  _auxinf.evthds = evthds;
                                                                                                                  _auxinf.evthdsShared = true;
                                                                                                              } else {
                                                                                                                  _auxinf.evthds.addAll(evthds);
                                                                                                  Severity: Minor
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 35 mins to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 2829..2834

                                                                                                  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 (extra.length() > 0) {
                                                                                                                      out.write(",0,null,'");
                                                                                                                      out.write(Strings.escape(extra, Strings.ESCAPE_JAVASCRIPT));
                                                                                                                      out.write('\'');
                                                                                                                  }
                                                                                                  Severity: Minor
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 35 mins to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java on lines 808..812

                                                                                                  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

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

                                                                                                              ComponentDefinition compdef = pgdef != null ? pgdef.getComponentDefinition(name, true)
                                                                                                                      : page != null ? page.getComponentDefinition(name, true) : null;
                                                                                                  Severity: Minor
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 30 mins to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/Impls.java on lines 46..47

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

                                                                                                  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 ((flags & CE_DUPLICATE_IGNORE) != 0 && (isImportant || isListened)) {
                                                                                                                  renderer.render("$$0" + evtnm, true);
                                                                                                              }
                                                                                                  Severity: Minor
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 30 mins to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 2325..2327

                                                                                                  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 ((flags & CE_REPEAT_IGNORE) != 0 && (isImportant || isListened)) {
                                                                                                                  renderer.render("$$1" + evtnm, true);
                                                                                                              }
                                                                                                  Severity: Minor
                                                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java and 1 other location - About 30 mins to fix
                                                                                                  zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 2322..2324

                                                                                                  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