Showing 7,777 of 7,777 total issues

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

    File WpdExtendlet.java has 910 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      Function fixFlex has a Cognitive Complexity of 109 (exceeds 5 allowed). Consider refactoring.
      Open

              fixFlex(wgt: zk.Widget): void {
                  let hflexWgt;
                  if (wgt._flexFixed || (!wgt._nvflex && !wgt._nhflex)) { //other vflex/hflex sibliing has done it!
                      delete wgt._flexFixed;
                      return;
      Severity: Minor
      Found in zk/src/main/resources/web/js/zk/flex.ts - About 2 days 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

      File purify.js has 896 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*! @license DOMPurify 3.0.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.6/LICENSE */
      
      (function (global, factory) {
        typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
        typeof define === 'function' && define.amd ? define(factory) :
      Severity: Major
      Found in zk/src/main/resources/web/js/zk/ext/purify.js - About 2 days to fix

        Method insertBefore has a Cognitive Complexity of 108 (exceeds 5 allowed). Consider refactoring.
        Open

            public boolean insertBefore(Component newChild, Component refChild) {
                if (newChild instanceof Listitem) {
                    final boolean isReorder = newChild.getParent() == this;
                    //bug #3051305: Active Page not update when drag & drop item to the end
                    if (isReorder) {
        Severity: Minor
        Found in zul/src/main/java/org/zkoss/zul/Listbox.java - About 2 days 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 104 (exceeds 5 allowed). Consider refactoring.
        Open

            public void redraw(Writer out) throws java.io.IOException {
                //Note: _tag == null can NOT be handled specially
                final Execution exec = Executions.getCurrent();
                final boolean root = getParent() == null && (getPage().isComplete()
                        || (exec != null && "complete".equals(ExecutionsCtrl.getPageRedrawControl(exec))));
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/HtmlNativeComponent.java - About 2 days 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

        File Combobox.java has 855 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* Combobox.java
        
            Purpose:
        
            Description:
        Severity: Major
        Found in zul/src/main/java/org/zkoss/zul/Combobox.java - About 2 days to fix

          Method write has a Cognitive Complexity of 102 (exceeds 5 allowed). Consider refactoring.
          Open

              public static void write(HttpServletRequest request, HttpServletResponse response, Media media, boolean download,
                      boolean repeatable) throws IOException {
                  //2012/03/09 TonyQ: ZK-885 Iframe with PDF stop works in IE 8 when we have Accept-Ranges = bytes.
          
                  if (!Servlets.isBrowser(request, "ie")) {
          Severity: Minor
          Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 2 days 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

          File HtmlPageRenders.java has 845 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

            Method resolveVariable0 has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring.
            Open

                protected Object resolveVariable0(Object self, XelContext ctx, Object base, Object onm) {
                    if (base != null) {
                        Object o = ((ExecutionCtrl) _exec).getExtraXelVariable(ctx, base, onm);
                        if (o != null)
                            return o;
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/xel/impl/ExecutionResolver.java - About 2 days 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

            Function format has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring.
            Open

                format(fmt: string, val: string, rounding: number, localizedSymbols?: zk.LocalizedSymbols): string {
                    if (val == null) return '';
                    if (!fmt) return val + '';
                    
                    if (fmt.startsWith('locale:')) {
            Severity: Minor
            Found in zk/src/main/resources/web/js/zk/fmt/numfmt.ts - About 2 days to fix

            Cognitive Complexity

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

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

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

            Further reading

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

                public static class TreeModelFactory {
                    public static DefaultTreeModel getSingleColDefaultTreeModel(int level1, int level2, int level3) {
                        return getSingleColDefaultTreeModel(level1 ,level2, level3,"item");
                    }
                    public static DefaultTreeModel getSingleColDefaultTreeModel(int level1, int level2, int level3, String label) {
            Severity: Major
            Found in zktest/src/main/java/org/zkoss/zktest/util/ModelProvider.java and 1 other location - About 2 days to fix
            zksandbox/src/main/java/org/zkoss/zksandbox/ModelProvider.java on lines 180..270

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

            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 static class TreeModelFactory {
                    public static DefaultTreeModel getSingleColDefaultTreeModel(int level1, int level2, int level3) {
                        return getSingleColDefaultTreeModel(level1 ,level2, level3,"item");
                    }
                    public static DefaultTreeModel getSingleColDefaultTreeModel(int level1, int level2, int level3, String label) {
            Severity: Major
            Found in zksandbox/src/main/java/org/zkoss/zksandbox/ModelProvider.java and 1 other location - About 2 days to fix
            zktest/src/main/java/org/zkoss/zktest/util/ModelProvider.java on lines 180..270

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

            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

            UiEngineImpl has 103 methods (exceeds 20 allowed). Consider refactoring.
            Open

            public class UiEngineImpl implements UiEngine {
                /*package*/ static final Logger log = LoggerFactory.getLogger(UiEngineImpl.class);
            
                /** The Web application this engine belongs to. */
                private WebApp _wapp;
            Severity: Major
            Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiEngineImpl.java - About 1 day to fix

              Method unescape has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring.
              Open

                  static String unescape(final String text) {
              
                      if (text == null) {
                          return null;
                      }
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/lang/JavaScriptEscapeUtil.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 renderValue has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring.
              Open

                  private void renderValue(Object value) {
                      if (value == null || value instanceof String) {
                          renderValue((String) value);
                          return;
                      }
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/sys/JsContentRenderer.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

              Exec has 100 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  private static class Exec implements Execution {
                      private static final Execution exec() {
                          return Executions.getCurrent();
                      }
              
              
              Severity: Major
              Found in zk/src/main/java/org/zkoss/zk/ui/Components.java - About 1 day to fix

                Method unescape has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring.
                Open

                    static void unescape(final char[] text, final int offset, final int len, final Writer writer)
                                         throws IOException {
                
                        if (text == null) {
                            return;
                Severity: Minor
                Found in zcommon/src/main/java/org/zkoss/lang/JavaScriptEscapeUtil.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 Equality has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring.
                Open

                  final public void Equality() throws ParseException {
                    Compare();
                    label_9:
                    while (true) {
                      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
                Severity: Minor
                Found in zel/src/main/java/org/zkoss/zel/impl/parser/ELParser.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

                File AnnotateBinderHelper.java has 778 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /* AnnotateBinderHelper.java
                
                    Purpose:
                        
                    Description:
                Severity: Major
                Found in zkbind/src/main/java/org/zkoss/bind/impl/AnnotateBinderHelper.java - About 1 day to fix
                  Severity
                  Category
                  Status
                  Source
                  Language