Showing 4,841 of 7,782 total issues

Method autoFirstCell has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private Label autoFirstCell() {
        Component cell = getFirstChild();
        if (cell == null || cell instanceof Label || cell instanceof Cell) {
            if (cell == null)
                cell = new Label();
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/Groupfoot.java - About 1 hr 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 onEvent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        public void onEvent(Event event) {
            //Bug ZK-1622: reset anchor position after changing page
            _anchorTop = 0;
            _anchorLeft = 0;
            if (event instanceof PagingEvent) {
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/Listbox.java - About 1 hr 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 load has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public V load(String src) throws Exception {
        if (log.isDebugEnabled())
            log.debug("Parse {}", src);
        final String path = getRealPath(src);
        InputStream is = null;
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/util/resource/ExtendletLoader.java - About 1 hr 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 fixName has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private String fixName(String name, boolean prefix) {
        name = name.length() > 0 && name.charAt(0) != '/'
                ? _dir != null ? _dir + name : prefix && _prefix != null ? '/' + name : name : name;
        return prefix && _prefix != null ? _prefix + name : (_externalPrefix == null ?  "" : _externalPrefix) + name;
    }

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

    public V put(K key, V o) {
        final V ret;
        if (_map.containsKey(key)) {
            if (Objects.equals(o, _map.get(key))) {
                return o; //nothing changed
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/ListModelMap.java - About 1 hr 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 readObject has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
        s.defaultReadObject();

        //the performance is bad, but no better algorithm
        @SuppressWarnings("rawtypes")
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/ListModelMap.java - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
Open

    @SuppressWarnings("rawtypes")
    public Object resolveVariable(XelContext ctx, Object base, Object name) throws XelException {
        if (base != null || !(name instanceof String))
            return null;

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

    public static final byte[] gzip(HttpServletRequest request, HttpServletResponse response, InputStream content1,
            byte[] content2) throws IOException {
        //We check Content-Encoding first to avoid compressing twice
        String ae = request.getHeader("accept-encoding");
        if (ae != null && !response.containsHeader("Content-Encoding")) {
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/http/Https.java - About 1 hr 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 getNodeSize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function getNodeSize(node, levelInfos) {
    if (node.children) {
        var cn = node.children.length;
        levelInfos.depth++;
        if (levelInfos.nodeSizes[levelInfos.depth]) {
Severity: Minor
Found in zktest/src/main/webapp/js/dtree.js - About 1 hr 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 comboitem$mold$ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function comboitem$mold$(out) {
    out.push('<li', this.domAttrs_({text: true}), '>');

    const iconHTML = this.domIcon_(), imgHTML = this.domImage_();
    if (imgHTML) {
Severity: Minor
Found in zul/src/main/resources/web/js/zul/inp/mold/comboitem.js - About 1 hr 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 menubar$mold$ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function menubar$mold$(out) {
    let w;
    const uuid = this.uuid;
    if ('vertical' === this.getOrient()) {
        out.push('<div', this.domAttrs_(), ' role="menubar" aria-orientation="vertical"><ul id="', uuid, '-cave" role="none">');
Severity: Minor
Found in zul/src/main/resources/web/js/zul/menu/mold/menubar.js - About 1 hr 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 wrongValue has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

            export function wrongValue(...args: string[]): void {
                for (var i = 0, len = args.length - 1; i < len; i += 2) {
                    var uuid = args[i], msg = args[i + 1],
                        wgt = zk.Widget.$(uuid);
                    if (wgt) {
Severity: Minor
Found in zk/src/main/resources/web/js/zk/au.ts - About 1 hr 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 _removeEventFunction has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function _removeEventFunction(elem: Element, type: string, fn: CallableFunction): boolean {
    var eventFuncs = jq.data(elem, 'zk_eventFuncs') as Record<string, CallableFunction[]>,
        funcs: CallableFunction[];

    if (eventFuncs && (funcs = eventFuncs[type])) {
Severity: Minor
Found in zk/src/main/resources/web/js/zk/domtouch.ts - About 1 hr 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 redirect has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

            export function redirect(url: string, target?: string): void {
                try {
                    zUtl.go(url, { target: target });

                    // '#' for bookmark change only, Bug ZK-2874
Severity: Minor
Found in zk/src/main/resources/web/js/zk/au.ts - About 1 hr 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 viewportOffset has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    viewportOffset(): zk.Offset {
        // eslint-disable-next-line zk/noNull
        var t = 0, l = 0, el: HTMLElement | null = this.jq[0], p = el;
        while (p) {
            t += p.offsetTop || 0;
Severity: Minor
Found in zk/src/main/resources/web/js/zk/dom.ts - About 1 hr 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 scrollbarWidth has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    scrollbarWidth(): number {
        var devicePixelRatio = zUtl.getDevicePixelRatio(),
            body = document.body;
        if (this['_lastDevicePixelRatio'] != devicePixelRatio) {
            this['_lastDevicePixelRatio'] = devicePixelRatio;
Severity: Minor
Found in zk/src/main/resources/web/js/zk/dom.ts - About 1 hr 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 _dblTapEnd has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    _dblTapEnd(evt: JQuery.TouchEndEvent) {
        var tevt = evt.originalEvent as TouchEvent;
        if (tevt.touches.length > 1) return;
        if (this._dbTap) {
            this._dbTap = this._tapValid = false;
Severity: Minor
Found in zk/src/main/resources/web/js/zk/domtouch.ts - About 1 hr 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 $toLocaleString has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    $toLocaleString(): string { //toLocaleString is reserved keyword for IE
        if (this._value.length == 0) return '';
        var j = this._value.length - this._precision;
        if (j <= 0) {
            var valFixed = '';
Severity: Minor
Found in zk/src/main/resources/web/js/zk/math.ts - About 1 hr 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 getMethod has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static Method getMethod(Class<?> type, Method m) {
        if (m == null || Modifier.isPublic(type.getModifiers())) {
            return m;
        }
        Class<?>[] inf = type.getInterfaces();
Severity: Minor
Found in zel/src/main/java/org/zkoss/zel/impl/util/ReflectionUtil.java - About 1 hr to fix

    Method getValidator1 has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public Validator getValidator1(){
            return new Validator() {
                public void validate(ValidationContext ctx) {
                    Boolean v1 = (Boolean)ctx.getBindContext().getBindingArg("v1");
                    Boolean v2 = (Boolean)ctx.getBindContext().getBindingArg("v2");
      Severity
      Category
      Status
      Source
      Language