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

Summary

Maintainability
F
1 wk
Test Coverage

File PageImpl.java has 1044 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* PageImpl.java

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

    PageImpl has 117 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class PageImpl extends AbstractPage implements java.io.Serializable {
        private static final Logger log = LoggerFactory.getLogger(PageImpl.class);
        private static final long serialVersionUID = 20110726L;
    
        /** The component that includes this page, or null if not included. */
    Severity: Major
    Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java - About 2 days to fix

      Method init has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

          public void init(PageConfig config) {
              final Execution exec = Executions.getCurrent();
              if (((ExecutionCtrl) exec).isRecovering()) {
                  final String uuid = config.getUuid(), id = config.getId();
                  if (uuid == null || id == null)
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.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 redraw has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          public void redraw(Writer out) throws IOException {
              String ctl;
              final Execution exec = getExecution();
              final boolean au = exec.isAsyncUpdate(null);
              if (!au && !exec.isIncluded()
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.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 init has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public void init(PageConfig config) {
              final Execution exec = Executions.getCurrent();
              if (((ExecutionCtrl) exec).isRecovering()) {
                  final String uuid = config.getUuid(), id = config.getId();
                  if (uuid == null || id == null)
      Severity: Major
      Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java - About 2 hrs to fix

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

            public boolean removeEventListener(String evtnm, EventListener<? extends Event> listener) {
                if (evtnm == null || listener == null)
                    throw new NullPointerException();
        
                if (_listeners != null) {
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.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 evalDeferredZScripts has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            private void evalDeferredZScripts(Interpreter ip, String zslang) {
                if (_zsDeferred != null) {
                    for (Iterator<Object[]> it = _zsDeferred.iterator(); it.hasNext();) {
                        final Object[] zsInfo = it.next();
                        final ZScript zscript = (ZScript) zsInfo[1];
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.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 readObject has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
                s.defaultReadObject();
        
                init();
        
        
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.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 a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            public boolean addEventListener(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/impl/PageImpl.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 getAttributes has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            public Map<String, Object> getAttributes(int scope) {
                switch (scope) {
                case DESKTOP_SCOPE:
                    if (_desktop != null)
                        return _desktop.getAttributes();
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.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 getInterpreter has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            public Interpreter getInterpreter(String zslang) {
                zslang = (zslang != null ? zslang : _zslang).toLowerCase(java.util.Locale.ENGLISH);
                Interpreter ip = _ips.get(zslang);
                if (ip == null) {
                    if (_desktop != null //might be null, if deserialized
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.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 setTitle has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            public void setTitle(String title) {
                if (title == null)
                    title = "";
                if (!_title.equals(title)) {
                    _title = title;
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.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 redraw has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public void redraw(Writer out) throws IOException {
                String ctl;
                final Execution exec = getExecution();
                final boolean au = exec.isAsyncUpdate(null);
                if (!au && !exec.isIncluded()
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java - About 1 hr to fix

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

              private synchronized void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
                  s.defaultWriteObject();
          
                  s.writeObject(_langdef != null ? _langdef.getName() : null);
                  s.writeObject(_owner != null ? _owner.getUuid() : null);
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.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 readObject has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
                  s.defaultReadObject();
          
                  init();
          
          
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java - About 1 hr to fix

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

                public void setViewport(String viewport) {
                    if (viewport == null)
                        viewport = "auto";
                    if (!_viewport.equals(viewport)) {
                        _viewport = viewport;
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.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 setStyle has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                public void setStyle(String style) {
                    if (style == null)
                        style = "";
                    if (!_style.equals(style)) {
                        _style = style;
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.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 resolveClass has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                    public Class resolveClass(String name) throws XelException {
                        if (_mappers != null) {
                            for (Iterator it = CollectionsX.comodifiableIterator(_mappers); it.hasNext();) {
                                final FunctionMapper mapper = (FunctionMapper) it.next();
                                if (mapper instanceof FunctionMapperExt) {
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.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 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private synchronized void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
                    s.defaultWriteObject();
            
                    s.writeObject(_langdef != null ? _langdef.getName() : null);
                    s.writeObject(_owner != null ? _owner.getUuid() : null);
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java - About 1 hr to fix

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

                  public boolean addClassResolver(ClassResolver resolver) {
                      //Currently we support only SimpleClassResolver and ImportedClassResolver
                      //but it is good enough
                      if (resolver == null)
                          return false;
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.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 9 (exceeds 5 allowed). Consider refactoring.
              Open

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

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

                  public Object getXelVariable(XelContext ctx, Object base, Object name, boolean ignoreExec) {
                      if (!ignoreExec) {
                          final Execution exec = getExecution();
                          if (exec != null)
                              return Evaluators.resolveVariable(ctx, exec.getVariableResolver(), base, name);
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.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 destroy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public void destroy() {
                      super.destroy();
                      try {
                          if (_ips != null) {
                              final List<Interpreter> ips = new ArrayList<Interpreter>(_ips.values());
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.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 (ls.size() == 1)
                                          _listeners.remove(evtnm);
                                      else
                                          it.remove();
              Severity: Major
              Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if (add)
                                            exec.addResponseHeader(nm, (Date) val);
                                        else
                                            exec.setResponseHeader(nm, (Date) val);
                Severity: Major
                Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java - About 45 mins to fix

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

                          public Collection<String> getClassNames() {
                              Collection<String> coll = null;
                              if (_mappers != null) {
                                  for (Iterator it = CollectionsX.comodifiableIterator(_mappers); it.hasNext();) {
                                      final FunctionMapper mapper = (FunctionMapper) it.next();
                  Severity: Minor
                  Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.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 resolveFunction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                          public Function resolveFunction(String prefix, String name) throws XelException {
                              if (_mappers != null) {
                                  for (Iterator<FunctionMapper> it = CollectionsX.comodifiableIterator(_mappers); it.hasNext();) {
                                      final Function f = it.next().resolveFunction(prefix, name);
                                      if (f != null)
                  Severity: Minor
                  Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.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 Collections.emptyMap();
                  Severity: Major
                  Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java - About 30 mins to fix

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

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

                        public void sessionDidActivate(Desktop desktop) {
                            _desktop = desktop;
                    
                            if (_ownerUuid != null) {
                                setOwner(_desktop.getComponentByUuid(_ownerUuid));
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.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 void setViewport(String viewport) {
                            if (viewport == null)
                                viewport = "auto";
                            if (!_viewport.equals(viewport)) {
                                _viewport = viewport;
                    Severity: Major
                    Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java and 1 other location - About 1 hr to fix
                    zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java on lines 394..409

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                        public void setStyle(String style) {
                            if (style == null)
                                style = "";
                            if (!_style.equals(style)) {
                                _style = style;
                    Severity: Major
                    Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java and 1 other location - About 1 hr to fix
                    zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java on lines 415..429

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

                    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 ComponentDefinition getComponentDefinition(Class<? extends Component> cls, boolean recurse) {
                            ComponentDefinition compdef = _compdefs.get(cls);
                            if (!recurse || compdef != null)
                                return compdef;
                    
                    
                    Severity: Major
                    Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java and 3 other locations - About 1 hr to fix
                    zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java on lines 1149..1158
                    zk/src/main/java/org/zkoss/zk/ui/metainfo/PageDefinition.java on lines 782..791
                    zk/src/main/java/org/zkoss/zk/ui/metainfo/PageDefinition.java on lines 802..811

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

                    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 ComponentDefinition getComponentDefinition(String name, boolean recurse) {
                            ComponentDefinition compdef = _compdefs.get(name);
                            if (!recurse || compdef != null)
                                return compdef;
                    
                    
                    Severity: Major
                    Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java and 3 other locations - About 1 hr to fix
                    zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java on lines 1160..1169
                    zk/src/main/java/org/zkoss/zk/ui/metainfo/PageDefinition.java on lines 782..791
                    zk/src/main/java/org/zkoss/zk/ui/metainfo/PageDefinition.java on lines 802..811

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

                    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 (_desktop != null) {
                                    if (_desktop.hasAttribute(name, true))
                                        return _desktop.setAttribute(name, value, true);
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java and 1 other location - About 50 mins to fix
                    zk/src/main/java/org/zkoss/zk/ui/http/SimpleSession.java on lines 238..246

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

                    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 (_desktop != null) {
                                    if (_desktop.hasAttribute(name, true))
                                        return _desktop.removeAttribute(name, true);
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java and 1 other location - About 50 mins to fix
                    zk/src/main/java/org/zkoss/zk/ui/http/SimpleSession.java on lines 248..257

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 59.

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

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

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

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

                    Refactorings

                    Further Reading

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

                        public boolean addFunctionMapper(FunctionMapper mapper) {
                            if (mapper == null)
                                return false;
                    
                            if (_mappers == null)
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java and 1 other location - About 50 mins to fix
                    zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java on lines 667..678

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

                    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 boolean addVariableResolver(VariableResolver resolver) {
                            if (resolver == null)
                                return false;
                    
                            if (_resolvers == null)
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java and 1 other location - About 50 mins to fix
                    zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java on lines 327..338

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

                    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

                        private static <E> Collection<E> combine(Collection<E> first, Collection<E> second) {
                            return DualCollection.combine(first != null && !first.isEmpty() ? first : null,
                                    second != null && !second.isEmpty() ? second : null);
                        }
                    Severity: Major
                    Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java and 2 other locations - About 40 mins to fix
                    zcommon/src/main/java/org/zkoss/xel/util/DualFunctionMapper.java on lines 84..88
                    zcommon/src/main/java/org/zkoss/xel/util/SimpleMapper.java on lines 71..75

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

                    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 void setExpressionFactoryClass(Class<? extends ExpressionFactory> expfcls) {
                            if (expfcls != null && !ExpressionFactory.class.isAssignableFrom(expfcls))
                                throw new IllegalArgumentException(expfcls + " must implement " + ExpressionFactory.class);
                            _expfcls = expfcls;
                        }
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java and 1 other location - About 35 mins to fix
                    zcommon/src/main/java/org/zkoss/xel/Expressions.java on lines 170..174

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 44.

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

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

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

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

                    Refactorings

                    Further Reading

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

                        public Class<?> getZScriptClass(String clsnm) {
                            for (Interpreter ip : getLoadedInterpreters()) {
                                Class<?> cls = ip.getClass(clsnm);
                                if (cls != null)
                                    return cls;
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java and 1 other location - About 30 mins to fix
                    zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java on lines 626..633

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 42.

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

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

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

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

                    Refactorings

                    Further Reading

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

                        public Object getZScriptVariable(String name) {
                            for (Interpreter ip : getLoadedInterpreters()) {
                                final Object val = ip.getVariable(name);
                                if (val != null)
                                    return val;
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java and 1 other location - About 30 mins to fix
                    zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java on lines 598..605

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 42.

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

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

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

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

                    Refactorings

                    Further Reading

                    There are no issues that match your filters.

                    Category
                    Status