Showing 7,775 of 7,775 total issues

Method getResourceAsStream has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        private InputStream getResourceAsStream() {
            return _prtctx != null ? _prtctx.getResourceAsStream(_uri)
                    : _svlctx != null ? _svlctx.getResourceAsStream(_uri)
                            : _extctx != null ? _extctx.getResourceAsStream(_uri) : null;
        }
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/portlet/Portlets.java - About 55 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 getFilters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public Filter[] getFilters(String ext, int flag) {
        if (ext == null)
            return null;

        ext = ext.toLowerCase(java.util.Locale.ENGLISH);
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/util/resource/ClassWebResource.java - About 55 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 resolveThemeURL has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static final String resolveThemeURL(String url) {
        if (url == null)
            return null;

        String themeName = ThemeFns.getCurrentTheme();
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/fn/ServletFns.java - About 55 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 parseCSS has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static int[] parseCSS(String code, int[] arr) {
        if (code == null)
            return arr;
        if (arr == null)
            arr = new int[4];
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/fn/Colors.java - About 55 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 smartUpdate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    @SuppressWarnings("unchecked")
    protected void smartUpdate(String name, Object value) {
        Component comp = getParent();
        if (comp instanceof Treeitem) {
            Treerow tr = ((Treeitem) comp).getTreerow();
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/Treechildren.java - About 55 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 addToQueryString has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static final StringBuffer addToQueryString(StringBuffer sb, String name, Object value)
            throws UnsupportedEncodingException {
        if (value instanceof Object[]) {
            final Object[] vals = (Object[]) value;
            if (vals.length == 0) {
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/http/Encodes.java - About 55 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 getWriter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public PrintWriter getWriter() throws IOException {
        if (_sos != null)
            throw new IllegalStateException("getOutputStream was called");

        if (_pwt == null) {
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/http/HttpBufferedResponse.java - About 55 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 checkColorRange has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private void checkColorRange(int r, int g, int b, int a) {
        String wrongColors = "";
        boolean gotError = false;
        if (r < 0 || r > 255) {
            gotError = true;
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/fn/Color.java - About 55 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 renderWith has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private void renderWith(ActionContext ac, Status st, Iterator it) throws DspException, IOException {
        final StringWriter out = getFragmentOut(ac, _trim);

        for (int j = 0; ++j <= _beg && it.hasNext();) //skip
            it.next();
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/dsp/action/ForEach.java - About 55 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 getWriter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public PrintWriter getWriter() throws IOException {
        if (_sos != null)
            throw new IllegalStateException("getOutputStream was called");

        if (_pwt == null) {
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/BufferedResponse.java - About 55 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 getCurrentTheme has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static String getCurrentTheme() {
        // 1. cookie's key
        String t = getTheme();
        if (_themeRegistry.hasTheme(t))
            return t;
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/fn/ThemeFns.java - About 55 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 renderWith has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private void renderWith(ActionContext ac, Status st, Enumeration enm) throws DspException, IOException {
        final StringWriter out = getFragmentOut(ac, _trim);

        for (int j = 0; ++j <= _beg && enm.hasMoreElements();) //skip
            enm.nextElement();
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/dsp/action/ForEach.java - About 55 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 tabpanel$mold$ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function tabpanel$mold$(out) {
    let w;
    const uuid = this.uuid,
        tabbox = this.getTabbox();
    if (tabbox.inAccordionMold()) {//Accordion
Severity: Minor
Found in zul/src/main/resources/web/js/zul/tab/mold/tabpanel.js - About 55 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 send has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        export function send(aureq: zk.Event, timeout = 0): void {
            //ZK-2790: when unload event is triggered, the desktop is destroyed
            //we shouldn't send request back to server
            if (zk.unloading && zk.rmDesktoping) //it's safer to check if both zk.unloading and zk.rmDesktoping are true
                return;
Severity: Minor
Found in zk/src/main/resources/web/js/zk/au.ts - About 55 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 ajaxSend has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function ajaxSend(dt: zk.Desktop, aureq: zk.Event, timeout?: number): void {
    //ZK-1523: dt(desktop) could be null, so search the desktop from target's parent.
    //call stack: echo2() -> send()
    if (!dt) {
        //original dt is decided by aureq.target.desktop, so start by it's parent.
Severity: Minor
Found in zk/src/main/resources/web/js/zk/au.ts - About 55 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 redoCSS has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    redoCSS(timeout?: number, opts?: Partial<RedoCSSOptions>): this {
        if (opts?.fixFontIcon) {
            return this;
        }
        if (timeout == -1) { //timeout -1 means immediately
Severity: Minor
Found in zk/src/main/resources/web/js/zk/dom.ts - About 55 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 isRealScrollIntoView has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    isRealScrollIntoView(opt?: boolean): boolean {
        var wgt = this.$();
        if (!wgt)
            return false;
        var desktop = wgt.desktop,
Severity: Minor
Found in zk/src/main/resources/web/js/zk/dom.ts - About 55 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 _removePrefixSharps has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    _removePrefixSharps(val: string, localizedSymbols: zk.LocalizedSymbols): string {
        var ret = '',
            sharp = true;
        for (var len = val.length, j = 0; j < len; ++j) {
            var cc = val.charAt(j);
Severity: Minor
Found in zk/src/main/resources/web/js/zk/fmt/numfmt.ts - About 55 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 isParameter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    isParameter: function (node: TSESTree.Node, expr: TSESTree.Node) {

        if (expr.type === 'CallExpression') {

            // Check whether any of the call arguments equals the node.
Severity: Minor
Found in eslint-plugin-zk/src/tree.ts - About 55 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 $equals has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    $equals(this: Array<unknown>, o): boolean {
        if (Array.isArray(o) && o.length == this.length) {
            for (var j = this.length; j--;) {
                var e = this[j];
                if (e != o[j] && (!Array.isArray(e) || !e.$equals(o[j])))
Severity: Minor
Found in zk/src/main/resources/web/js/zk/js.ts - About 55 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