Showing 4,841 of 7,782 total issues

Method setShadowHost has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    public void setShadowHost(Component host, Component insertBefore) {
        if (getParent() != null) {
            throw new UiException("As a shadow child cannot be a shadow root. [" + this + "]");
        }
        if (host == null) {
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 6 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method removeRedundant has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    private void removeRedundant() {
        int initsz = (_invalidated.size() + _attached.size()) / 2 + 30;
        final Set<Component> ins = new HashSet<Component>(initsz), //one of ancestor in _invalidated or _attached
                outs = new HashSet<Component>(initsz); //none of ancestor in _invalidated nor _attached
        final List<Component> ancs = new ArrayList<Component>(50);
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 6 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method addInfo has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    public void addInfo(JSONObject info) {

        Object type = info.get("type");
        if (!_startLine) {
            out("=======================================");

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 progressbox has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

        static progressbox(id: string, msg: string, mask?: boolean, icon?: string, opts?: Partial<ProgressboxOptions>): void {
            if (mask && zk.Page.contained.length) {
                for (var c = zk.Page.contained.length, e = zk.Page.contained[--c]; e; e = zk.Page.contained[--c]) {
                    if (!e._applyMask)
                        e._applyMask = new zk.eff.Mask({
Severity: Minor
Found in zk/src/main/resources/web/js/zk/utl.ts - About 6 hrs to fix

Cognitive Complexity

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

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

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

Further reading

File numfmt.ts has 427 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* numfmt.ts

    Purpose:
        
    Description:
Severity: Minor
Found in zk/src/main/resources/web/js/zk/fmt/numfmt.ts - About 6 hrs to fix

    File jquery.transit.js has 425 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * jQuery Transit - CSS3 transitions and transformations
     * (c) 2011-2014 Rico Sta. Cruz
     * MIT Licensed.
     *
    Severity: Minor
    Found in zk/src/main/resources/web/js/zk/ext/jquery.transit.js - About 6 hrs to fix

      Classes has 45 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public class Classes {
          private static final Logger log = LoggerFactory.getLogger(Classes.class);
      
          private static final Object NOT_FOUND = new Object();
      
      
      Severity: Minor
      Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 6 hrs to fix

        Servlets has 45 methods (exceeds 20 allowed). Consider refactoring.
        Open

        public class Servlets {
            private static final Logger log = LoggerFactory.getLogger(Servlets.class);
        
            private static ClientIdentifier _clientId;
            private static final Pattern _rwebkit = Pattern.compile(".*(webkit)[ /]([\\w.]+).*"),
        Severity: Minor
        Found in zweb/src/main/java/org/zkoss/web/servlet/Servlets.java - About 6 hrs to fix

          File ListModelListProxy.java has 421 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /** ListModelListProxy.java.
          
              Purpose:
          
              Description:
          Severity: Minor
          Found in zkbind/src/main/java/org/zkoss/bind/proxy/ListModelListProxy.java - About 6 hrs to fix

            Method meterAuClient has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
            Open

                private static void meterAuClient(PerformanceMeter pfmeter, Execution exec, String hdr, boolean complete) {
                    for (int j = 0;;) {
                        int k = hdr.indexOf(',', j);
                        String ids = k >= 0 ? hdr.substring(j, k) : j == 0 ? hdr : hdr.substring(j);
            
            
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiEngineImpl.java - About 6 hrs to fix

            Cognitive Complexity

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

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

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

            Further reading

            Method setSort has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
            Open

                public void setSort(String type) {
                    if (type == null)
                        return;
                    if (type.startsWith("client")) {
                        try {
            Severity: Minor
            Found in zul/src/main/java/org/zkoss/zul/Listheader.java - About 6 hrs to fix

            Cognitive Complexity

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

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

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

            Further reading

            Method setSort has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
            Open

                public void setSort(String type) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
                    if (type == null)
                        return;
                    if (type.startsWith("client")) {
                        try {
            Severity: Minor
            Found in zul/src/main/java/org/zkoss/zul/Treecol.java - About 6 hrs to fix

            Cognitive Complexity

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

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

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

            Further reading

            Method setSelectedIndex has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
            Open

                @SuppressWarnings("rawtypes")
                public void setSelectedIndex(int jsel) {
                    final int isz = _items.size();
                    final int tsz = _model != null ? _model.getSize() : isz;
                    if (jsel >= tsz)
            Severity: Minor
            Found in zul/src/main/java/org/zkoss/zul/Listbox.java - About 6 hrs to fix

            Cognitive Complexity

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

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

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

            Further reading

            Method grad has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
            Open

                private static String grad(String dir, Browser template, String[] colors) {
                    if ("|ver|hor|diag-|diag+|rad|".indexOf("|" + dir + "|") == -1)
                        throw new IllegalArgumentException("Type must be ver, hor, diag-, diag+, or rad.");
                    if (colors.length < 2)
                        throw new IllegalArgumentException("Please specify more than two colors.");
            Severity: Minor
            Found in zweb/src/main/java/org/zkoss/web/fn/ThemeFns.java - About 6 hrs to fix

            Cognitive Complexity

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

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

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

            Further reading

            Method resolveVariable has a Cognitive Complexity of 40 (exceeds 5 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: Minor
            Found in zweb/src/main/java/org/zkoss/web/servlet/xel/RequestXelResolver.java - About 6 hrs to fix

            Cognitive Complexity

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

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

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

            Further reading

            Method parseRange has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
            Open

                private static int[] parseRange(String range) {
                    range = range.toLowerCase(java.util.Locale.ENGLISH);
                    for (int j = 0, k, len = range.length(); (k = range.indexOf("bytes", j)) >= 0;) {
                        for (k += 5; k < len;) {
                            char cc = range.charAt(k++);
            Severity: Minor
            Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 6 hrs to fix

            Cognitive Complexity

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

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

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

            Further reading

            Method addListener has 152 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public void addListener(Class<?> klass) throws Exception {
                    boolean added = false;
                    Object listener = null;
            
                    if (Monitor.class.isAssignableFrom(klass)) {
            Severity: Major
            Found in zk/src/main/java/org/zkoss/zk/ui/util/Configuration.java - About 6 hrs to fix

              Method write has 152 lines of code (exceeds 25 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: Major
              Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 6 hrs to fix

                File effect.ts has 419 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /* effect.ts
                
                    Purpose:
                
                    Description:
                Severity: Minor
                Found in zk/src/main/resources/web/js/zk/effect.ts - About 6 hrs to fix

                  Slider has 44 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  public class Slider extends XulElement {
                      private String _orient = "horizontal", _mode = INTEGER;
                      private Double _curpos = 0.0, _minpos = 0.0, _maxpos = 100.0, _pginc = -1.0, _step = -1.0;
                      /** The name. */
                      private String _name;
                  Severity: Minor
                  Found in zul/src/main/java/org/zkoss/zul/Slider.java - About 6 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language