Showing 7,777 of 7,777 total issues

Method parseLang has a Cognitive Complexity of 223 (exceeds 5 allowed). Consider refactoring.
Open

    private static void parseLang(Document doc, Locator locator, URL url, boolean addon) throws Exception {
        final Element root = doc.getRootElement();
        final String lang = IDOMs.getRequiredElementValue(root, "language-name");
        final LanguageDefinition langdef;
        final Device device;
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java - About 4 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

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

private int jjMoveNfa_2(int startState, int curPos)
{
   int startsAt = 0;
   jjnewStateCnt = 30;
   int i = 1;
zel/src/main/java/org/zkoss/zel/impl/parser/ELParserTokenManager.java on lines 1491..1828

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

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 int jjMoveNfa_1(int startState, int curPos)
{
   int startsAt = 0;
   jjnewStateCnt = 30;
   int i = 1;
zel/src/main/java/org/zkoss/zel/impl/parser/ELParserTokenManager.java on lines 716..1053

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

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

File dom.ts has 1579 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable @typescript-eslint/dot-notation */
/* dom.ts

    Purpose:
        Enhance jQuery
Severity: Major
Found in zk/src/main/resources/web/js/zk/dom.ts - About 4 days to fix

    File d3.layout.js has 1549 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    (function(){d3.layout = {};
    // Implements hierarchical edge bundling using Holten's algorithm. For each
    // input link, a path is computed that travels through the tree, up the parent
    // hierarchy to the least common ancestor, and then back down to the destination
    // node. Each path is simply an array of nodes.
    Severity: Major
    Found in zktest/src/main/webapp/js/d3.layout.js - About 4 days to fix

      File Configuration.java has 1528 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* Configuration.java
      
          Purpose:
              
          Description:
      Severity: Major
      Found in zk/src/main/java/org/zkoss/zk/ui/util/Configuration.java - About 4 days to fix

        File au.ts has 1505 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* au.ts
        
            Purpose:
                ZK Client Engine
            Description:
        Severity: Major
        Found in zk/src/main/resources/web/js/zk/au.ts - About 4 days to fix

          File Parser.java has 1497 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

            Method jjMoveNfa_0 has a Cognitive Complexity of 195 (exceeds 5 allowed). Consider refactoring.
            Open

            private int jjMoveNfa_0(int startState, int curPos)
            {
               int startsAt = 0;
               jjnewStateCnt = 8;
               int i = 1;
            Severity: Minor
            Found in zel/src/main/java/org/zkoss/zel/impl/parser/ELParserTokenManager.java - About 3 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 DesktopImpl.java has 1453 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

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

              Configuration has 192 methods (exceeds 20 allowed). Consider refactoring.
              Open

              public class Configuration {
                  private static final Logger log = LoggerFactory.getLogger(Configuration.class);
              
                  private static final String PROP_EXPRESS_FACTORY = "org.zkoss.xel.ExpressionFactory.class";
              
              
              Severity: Major
              Found in zk/src/main/java/org/zkoss/zk/ui/util/Configuration.java - About 3 days to fix

                Method parse has a Cognitive Complexity of 184 (exceeds 5 allowed). Consider refactoring.
                Open

                    private Object parse(RequestContext reqctx, InputStream is, String path) throws Exception {
                        final Element root = new SAXBuilder(true, false, true).build(is).getRootElement();
                        final String name = IDOMs.getRequiredAttributeValue(root, "name");
                        if (name.length() == 0)
                            throw new UiException("The name attribute must be specified, " + root.getLocator() + ", " + path);
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/ui/http/WpdExtendlet.java - About 3 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 createDOMPurify has 714 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function createDOMPurify() {
                    let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
                
                    const DOMPurify = root => createDOMPurify(root);
                    /**
                Severity: Major
                Found in zk/src/main/resources/web/js/zk/ext/purify.js - About 3 days to fix

                  Method Compare has a Cognitive Complexity of 174 (exceeds 5 allowed). Consider refactoring.
                  Open

                    final public void Compare() throws ParseException {
                      Concatenation();
                      label_10:
                      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 3 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

                  Listbox has 178 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  public class Listbox extends MeshElement {
                      private static final long serialVersionUID = 2009111111L;
                      public static final String LOADING_MODEL = "org.zkoss.zul.loadingModel";
                      public static final String SYNCING_MODEL = "org.zkoss.zul.syncingModel";
                  
                  
                  Severity: Major
                  Found in zul/src/main/java/org/zkoss/zul/Listbox.java - About 3 days to fix

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

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

                      File zk-3913-PDF417lib.js has 1305 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /*The MIT License (MIT)
                      
                      Copyright (c) 2014 James Liu j@jamesliu.info
                      */
                      
                      
                      Severity: Major
                      Found in zktest/src/main/webapp/test2/js/zk-3913-PDF417lib.js - About 3 days to fix

                        File Grid.java has 1280 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

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

                          ELParser has 160 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          @SuppressWarnings("all") // Ignore warnings in generated code
                          public class ELParser/*@bgen(jjtree)*/implements ELParserTreeConstants, ELParserConstants {/*@bgen(jjtree)*/
                            protected JJTELParserState jjtree = new JJTELParserState();
                              public static Node parse(String ref) throws ELException {
                                  try {
                          Severity: Major
                          Found in zel/src/main/java/org/zkoss/zel/impl/parser/ELParser.java - About 3 days to fix

                            Tree has 158 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                            @SuppressWarnings("serial")
                            public class Tree extends MeshElement {
                                private static final Logger log = LoggerFactory.getLogger(Tree.class);
                                private static final String ATTR_ON_INIT_RENDER_POSTED = "org.zkoss.zul.Tree.onInitLaterPosted";
                                public static final int DEFAULT_THROTTLE_MILLIS = 300;
                            Severity: Major
                            Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 3 days to fix
                              Severity
                              Category
                              Status
                              Source
                              Language