Showing 7,775 of 7,775 total issues

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

    public void setOrient(String orient) throws WrongValueException {
        if (!"horizontal".equals(orient) && !"top".equals(orient) && !"bottom".equals(orient)
                && !"vertical".equals(orient) && !"right".equals(orient) && !"left".equals(orient))
            throw new WrongValueException("Unknow orient : " + orient);
        if (inAccordionMold())
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/Tabbox.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 stringToArray has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static final String[] stringToArray(String src, String defaultValue) {
        if (src == null)
            return null;

        List<String> list = new LinkedList<String>();
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/impl/Utils.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 formatNumber has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected String formatNumber(Object value, String defaultFormat) {
        if (value == null)
            return "";

        final DecimalFormat df = (DecimalFormat) NumberFormat.getInstance(getDefaultLocale());
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/impl/NumberInputElement.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 onPageAttached has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public void onPageAttached(Page newpage, Page oldpage) {
        super.onPageAttached(newpage, oldpage);
        if (oldpage == null) { // mark as a new attached Listbox
            final Execution exec = Executions.getCurrent();
            exec.setAttribute("zkoss.Listbox.deferInitModel_" + getUuid(), Boolean.TRUE);
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 handleFunction has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private Object handleFunction(Object c, String func) {
        if ("UPPER".equals(func)) {
            if (c instanceof String)
                return ((String) c).toUpperCase();
            if (c instanceof Character)
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/FieldComparator.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 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 afterUnmarshal has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private void afterUnmarshal(int index) {
        for (Iterator<Component> it = getChildren().iterator(); it.hasNext();) {
            final Object child = it.next();
            if (child instanceof Listitem) {
                final Listitem li = (Listitem) child;
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 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 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 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 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 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 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 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 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

Severity
Category
Status
Source
Language