Showing 4,841 of 7,782 total issues

Method onChange has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

        public void onChange(GroupsDataEvent event) {
            int type = event.getType(), j0 = event.getIndex0(), j1 = event.getIndex1();

            switch (type) {
            case GroupsDataEvent.CONTENTS_CHANGED:
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/impl/GroupsListModel.java - About 3 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method parseAttrs has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    private static int parseAttrs(Context ctx, Map<String, String> attrs, String actnm, int from, int to)
            throws DspException {
        for (int j, k = from;;) {
            j = skipWhitespaces(ctx, k, to);
            k = nextSeparator(ctx, j, to);
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/dsp/impl/Parser.java - About 3 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function dataNotReady has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

function dataNotReady(cmd: string, data: ({ $u?: string } & zk.Widget | undefined)[]): boolean {
    for (var j = data.length, id: string | undefined, w: zk.Widget | undefined; j--;)
        if (id = data[j] && data[j]!.$u) {
            if (!(w = zk.Widget.$(id))) { //not ready
                var processFn = function (): void {
Severity: Minor
Found in zk/src/main/resources/web/js/zk/au.ts - About 3 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function position has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    position(dim?: Dimension | Element, where?: string, opts?: PositionOptions): this {
        where = where || 'overlap';

        if (!dim) {
            var bd = jq('body')[0];
Severity: Minor
Found in zk/src/main/resources/web/js/zk/dom.ts - About 3 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function bindTapHold_ has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    bindTapHold_() {
        if (this.isListen('onRightClick') || (window.zul && this instanceof zul.Widget && this.getContext())) { //also register context menu to tapHold event
            this._holdTime = 800;
            this._startHold = (evt: JQuery.TouchEventBase): void => {
                if (!this._rightClickPending) {
Severity: Minor
Found in zk/src/main/resources/web/js/zk/domtouch.ts - About 3 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method write has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    /*package*/ static void write(NameSpace ns, ObjectOutputStream s, Filter filter) throws IOException {
        //1. variables
        final String[] vars = ns.getVariableNames();
        for (int j = vars != null ? vars.length : 0; --j >= 0;) {
            final String nm = vars[j];
Severity: Major
Found in zk/src/main/java/org/zkoss/zk/scripting/bsh/BSHInterpreter.java - About 3 hrs to fix

    Function data has 93 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    d3_selectionPrototype.data = function(data, join) {
      var enter = [],
          update = [],
          exit = [];
    
    
    Severity: Major
    Found in zktest/src/main/webapp/js/d3.js - About 3 hrs to fix

      Method resolveVariable has 92 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @SuppressWarnings("unchecked")
          public Object resolveVariable(String name) throws XelException {
              if ("pageContext".equals(name)) {
                  return getPageContext();
              } else if ("pageScope".equals(name)) {
      Severity: Major
      Found in zweb/src/main/java/org/zkoss/web/servlet/xel/RequestXelResolver.java - About 3 hrs to fix

        Dates has 30 methods (exceeds 20 allowed). Consider refactoring.
        Open

        public class Dates {
            /**
             * Truncates date to the nearest precision milliseconds. MS SQLServer2000
             * with only the maximum accuracy of 1/300 seconds would not be able to
             * store up to one millisecond accuracy. That is, User must round the
        Severity: Minor
        Found in zcommon/src/main/java/org/zkoss/util/Dates.java - About 3 hrs to fix

          Attribute has 30 methods (exceeds 20 allowed). Consider refactoring.
          Open

          public class Attribute extends AbstractItem implements Namespaceable, Attr {
              /** The namespace. */
              protected Namespace _ns;
              /** The owner item. */
              protected Item _owner;
          Severity: Minor
          Found in zcommon/src/main/java/org/zkoss/idom/Attribute.java - About 3 hrs to fix

            F02545ChildrenBindingSupportListModelVM has 30 methods (exceeds 20 allowed). Consider refactoring.
            Open

            public class F02545ChildrenBindingSupportListModelVM implements Serializable{
                private static final long serialVersionUID = 1L;
                
                private List<Node> nodes_l;
                private String[] nodes_a1D = new String[] {

              JsContentRenderer has 30 methods (exceeds 20 allowed). Consider refactoring.
              Open

              public class JsContentRenderer implements ContentRenderer {
                  private final StringBuilder _buf = new StringBuilder(128);
              
                  public JsContentRenderer() {
                  }
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/sys/JsContentRenderer.java - About 3 hrs to fix

                AbstractCollectionProxy has 30 methods (exceeds 20 allowed). Consider refactoring.
                Open

                public abstract class AbstractCollectionProxy<E>
                        implements Collection<E>, Proxy, FormProxyObject, Serializable {
                    private Collection<E> _cache;
                    private static final long serialVersionUID = 20141225142801L;
                    private Object _origin;

                  ListModelSet has 30 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  public class ListModelSet<E> extends AbstractListModel<E> implements Sortable<E>, Set<E>, java.io.Serializable {
                      private static final long serialVersionUID = 20120206122849L;
                  
                      protected Set<E> _set;
                  
                  
                  Severity: Minor
                  Found in zul/src/main/java/org/zkoss/zul/ListModelSet.java - About 3 hrs to fix

                    ThemeFns has 30 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    public class ThemeFns {
                    
                        private ThemeFns() {
                        }
                    
                    Severity: Minor
                    Found in zweb/src/main/java/org/zkoss/web/fn/ThemeFns.java - About 3 hrs to fix

                      Https has 30 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      public class Https extends Servlets {
                          private static final Logger log = LoggerFactory.getLogger(Https.class);
                      
                          /** Compresses the content into an byte array, or null
                           * if the browser doesn't support the compression (accept-encoding).
                      Severity: Minor
                      Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 3 hrs to fix

                        Consider simplifying this complex logical expression.
                        Open

                                    if (
                                        // First condition does a very basic check if a) it's basically a valid custom element tagname AND
                                        // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
                                        // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
                                        _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) ||
                        Severity: Critical
                        Found in zk/src/main/resources/web/js/zk/ext/purify.js - About 3 hrs to fix

                          Method addPropertySaveBindings0 has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private void addPropertySaveBindings0(Component comp, String attr, String saveExpr, String[] beforeCmds,
                                      String[] afterCmds, Map<String, Object> bindingArgs, String converterExpr,
                                      Map<String, Object> converterArgs, String validatorExpr, Map<String, Object> validatorArgs) {
                                  final boolean prompt = isPrompt(beforeCmds, afterCmds);
                                  final BindingExecutionInfoCollector collector = getBindingExecutionInfoCollector();
                          Severity: Major
                          Found in zkbind/src/main/java/org/zkoss/bind/impl/BinderImpl.java - About 3 hrs to fix

                            File ListModelList.java has 318 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            /* ListModelList.java
                            
                            {{IS_NOTE
                                Purpose:
                                    
                            Severity: Minor
                            Found in zul/src/main/java/org/zkoss/zul/ListModelList.java - About 3 hrs to fix

                              Method service has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public void service(HttpServletRequest request, HttpServletResponse response, String path)
                                          throws ServletException, java.io.IOException {
                              
                                      String resourceCache = Library.getProperty("org.zkoss.zk.WCS.cache");
                                      if (resourceCache != null && "false".equalsIgnoreCase(resourceCache))
                              Severity: Major
                              Found in zk/src/main/java/org/zkoss/zk/ui/http/WcsExtendlet.java - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language