Showing 4,841 of 7,782 total issues

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

    public static final String getUserAgent(ServletRequest req) {
        if (req instanceof HttpServletRequest) {
            String s = ((HttpServletRequest) req).getHeader("user-agent");
            if (s != null) {
                String cache = (String) req.getAttribute("$$zkagent$$");
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/Servlets.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 getOriginPathInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static final String getOriginPathInfo(ServletRequest request) {
        String path = (String) request.getAttribute(Attributes.FORWARD_PATH_INFO);
        return path != null ? path : isForwarded(request) ? null
                : //null is valid even included
                request instanceof HttpServletRequest ? ((HttpServletRequest) request).getPathInfo() : null;
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.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 toIEHex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    @SuppressWarnings("unchecked")
    private static String toIEHex(String color) {
        color = color.trim();
        if (color.startsWith("#")) {
            int end = color.indexOf(" ");
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/fn/ThemeFns.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 startsWith has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static boolean startsWith(String content, int from, int to, String s) {
        for (int j = 0, len = s.length();; ++from, ++j) {
            if (j >= len)
                return true;
            if (from >= to || content.charAt(from) != s.charAt(j))
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/dsp/impl/Parser.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 toDate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static final Date toDate(String sdate) throws ParseException {
        ParseException ex = null;
        for (String df : _dfs) {
            try {
                return new SimpleDateFormat(df, Locale.US).parse(sdate);
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.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 getOriginQueryString has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static final String getOriginQueryString(ServletRequest request) {
        String path = (String) request.getAttribute(Attributes.FORWARD_QUERY_STRING);
        return path != null ? path : isForwarded(request) ? null
                : //null is valid even included
                request instanceof HttpServletRequest ? ((HttpServletRequest) request).getQueryString() : null;
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.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 toHex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    @SuppressWarnings("unchecked")
    private static String toHex(String color) {
        color = color.trim();
        if (color.startsWith("#")) {
            int end = color.indexOf(" ");
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/fn/ThemeFns.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 include has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public void include(String uri, Map params) throws ServletException, IOException {
        if (_dir != null && uri != null && uri.length() > 0) {
            char cc = uri.charAt(0);
            if (cc != '~' && cc != '/')
                uri = _dir + uri;
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/dsp/ExtendletDspContext.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 getCookieValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static final String getCookieValue(HttpServletRequest request, String name) {
        final Cookie[] cookies = request.getCookies();
        if (cookies != null) {
            for (int j = cookies.length; --j >= 0;) {
                if (cookies[j].getName().equals(name))
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.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 toScope has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected static final int toScope(String scope) {
        return "request".equals(scope) ? ActionContext.REQUEST_SCOPE
                : "session".equals(scope) ? ActionContext.SESSION_SCOPE
                        : "application".equals(scope) ? ActionContext.APPLICATION_SCOPE : ActionContext.PAGE_SCOPE;
    }
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/dsp/action/AbstractAction.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

Function _array_fill has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    _array_fill: function(a, b, c) {
        var d, e = {};
        if (0 == a) {
            a = [];
            for (d = 0; d < b; d++) a.push(c);
Severity: Minor
Found in zktest/src/main/webapp/test2/js/zk-3913-PDF417lib.js - 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

Function bc_sub has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

libbcmath.bc_sub = function(a, b, c) {
    var d, e;
    if (a.n_sign != b.n_sign) d = libbcmath._bc_do_add(a, b, c), d.n_sign = a.n_sign;
    else switch (e = libbcmath._bc_do_compare(a, b, !1, !1), e) {
        case -1:
Severity: Minor
Found in zktest/src/main/webapp/test2/js/zk-3913-PDF417lib.js - 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

Function toolbarpanel$mold$ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function toolbarpanel$mold$(out) {
    let w;
    out.push('<div ', this.domAttrs_(), '><table id="', this.uuid,
        '-cave" class="', this.$s('content'), ' ', this.$s(this.getAlign()),
        '"', /*safe*/ zUtl.cellps0, '><tbody>');
Severity: Minor
Found in zul/src/main/resources/web/js/zul/wgt/mold/toolbarpanel.js - 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

Function row$mold$ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function row$mold$(out) {
    out.push('<tr', this.domAttrs_(), '>');
    var /*safe*/ zcls = this.getZclass(),
        grid = this.getGrid(),
        head = grid.getHeadWidget();
Severity: Minor
Found in zul/src/main/resources/web/js/zul/grid/mold/row.js - 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

Function domClass_ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    domClass_(no?: zk.DomClassOptions): string {
        let domClass = /*safe*/ _xWidget.domClass_.call(this, no),
            n = this.$n() as HTMLElement | undefined;
        if (n) {
            const jqn = jq(n),
Severity: Minor
Found in zk/src/main/resources/web/js/zk/flex.ts - 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

Function setScale has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    setScale(val: zk.BigDecimal, scale: number, rounding: number): zk.BigDecimal { //bug #3089502: setScale in decimalbox not working
        if (scale === undefined || scale < 0)
            return val;
        var valStr = val.$toString(),
            indVal = valStr.indexOf('.'),
Severity: Minor
Found in zk/src/main/resources/web/js/zk/fmt/numfmt.ts - 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

Function sendAhead has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        export function sendAhead(aureq: zk.Event, timeout = 0): void {
            const t = aureq.target;
            if (t) {
                const dt = t instanceof zk.Desktop ? t : t.desktop!;
                zAu.getAuRequests(dt).unshift(aureq);
Severity: Minor
Found in zk/src/main/resources/web/js/zk/au.ts - 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

Function setSelectionRange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    setSelectionRange(start: number, end?: number): this {
        var inp = this.jq[0] as HTMLInputElement,
            len = inp.value ? inp.value.length : 0; //ZK-2805
        if (start == null || start < 0) start = 0;
        if (start > len) start = len;
Severity: Minor
Found in zk/src/main/resources/web/js/zk/dom.ts - 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

Function _docmouseup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    function _docmouseup(devt: JQuery.TriggeredEvent): void {
        if (_actTmout) {
            clearTimeout(_actTmout);
            _actTmout = undefined;
        }
Severity: Minor
Found in zk/src/main/resources/web/js/zk/drag.ts - 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

Function echo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

            export function echo(dtid?: string | zk.Desktop): void {
                var dt = zk.Desktop.$(dtid),
                    aureqs = dt ? zAu.getAuRequests(dt) : [];
                // Bug ZK-2741
                for (var i = 0, j = aureqs.length; i < j; i++) {
Severity: Minor
Found in zk/src/main/resources/web/js/zk/au.ts - 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

Severity
Category
Status
Source
Language