Showing 7,775 of 7,775 total issues

Method resolveVariable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        public Object resolveVariable(String name) {
            if (custom != null) {
                final Object o = custom instanceof VariableResolverX ?
                    ((VariableResolverX)custom).resolveVariable(null, null, name):
                    custom.resolveVariable(name);
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/util/resource/impl/LabelLoaderImpl.java - About 35 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 toString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public final static String toString(Object[] array) {
        if (array == null)
            return "null";

        StringBuffer sb = new StringBuffer(128).append('[');
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/util/ArraysX.java - About 35 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 toString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public String toString() {
        tryExpunge();

        final StringBuffer sb = new StringBuffer(128).append('{');
        if (!_map.isEmpty()) {
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/util/CacheMap.java - About 35 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 expunge has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public int expunge() {
        if (_inExpunge || _map.isEmpty()) return _map.size(); //nothing to do

        _inExpunge = true;
        try {
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/util/CacheMap.java - About 35 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 containsKey has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public boolean containsKey(Object key) {
        boolean found = _cache.containsKey(key);
        if (!found && _moreInWriteCache)
            synchronized (this) {
                if (_writeCache != null && (found = _writeCache.containsKey(key)))
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/util/FastReadCache.java - About 35 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 setDynamicProperty has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public void setDynamicProperty(String name, Object value) throws WrongValueException {
        if (name == null)
            throw new WrongValueException("name is required");
        if (!hasDynamicProperty(name))
            throw new WrongValueException("Attribute not allowed: " + name
Severity: Minor
Found in zhtml/src/main/java/org/zkoss/zhtml/impl/AbstractTag.java - About 35 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 resolveVariable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static Object resolveVariable(XelContext ctx,
    VariableResolver resolver, Object base, Object name) {
        if (resolver instanceof VariableResolverX) {
            if (ctx == null)
                ctx = new SimpleXelContext(resolver);
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/xel/util/Evaluators.java - About 35 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 getResource has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public URL getResource(String name) {
        // no need to use Classes.getContextClassLoader() here because of the loading order issue
        final ClassLoader cl = Thread.currentThread().getContextClassLoader();
        URL url = cl != null ? cl.getResource(resolveName(name)): null;
        if (url != null) {
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/util/resource/ClassLocator.java - About 35 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 next has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public T next() {
        if (_nextAvail) {
            _nextAvail = false;
            return _converter.convert(_next);
        }
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/util/ComodifiableIterator.java - About 35 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 init has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private void init(String name, byte[] data) throws IOException {
        if (data == null)
            throw new IllegalArgumentException("null data");
        _name = name;
        _data = data;
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/image/AImage.java - About 35 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 resolveVariable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static Object resolveVariable(XelContext ctx, Object base, Object name) {
        if (ctx != null) {
            VariableResolver resolver = ctx.getVariableResolver();
            if (resolver instanceof VariableResolverX)
                return  ((VariableResolverX)resolver).resolveVariable(ctx, base, name);
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/xel/util/Evaluators.java - About 35 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 equals has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof StyleSheet))
            return false;
        final StyleSheet ss = (StyleSheet)o;
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/html/StyleSheet.java - About 35 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 nextVerSeparator has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static final int nextVerSeparator(String version, int from) {
        for (final int len = version.length(); from < len; ++from) {
            final char cc = version.charAt(from);
            if ((cc < '0' || cc > '9') && (cc < 'a' || cc > 'z')
            && (cc < 'A' || cc > 'Z'))
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/util/Utils.java - About 35 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 length has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static final int length(Object o) {
        if (o instanceof String) {
            return ((String)o).length();
        } else if (o == null) {
            return 0;
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 35 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 zzRefill has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private boolean zzRefill() throws java.io.IOException {

    /* first: make room (if you can) */
    if (zzStartRead > 0) {
      System.arraycopy(zzBuffer, zzStartRead,
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/json/parser/Yylex.java - About 35 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 deleteAll has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static final boolean deleteAll(File file) {
        if (file.isDirectory()) {
            final File[] fls = file.listFiles();
            for (int j = 0; j < fls.length; ++j) {
                if (!deleteAll(fls[j]))
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/io/Files.java - About 35 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 isInstance has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static boolean isInstance(Object c, Object o) {
        if (c instanceof Class) {
            return ((Class)c).isInstance(o);
        } else if (c instanceof String) {
            try {
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/xel/fn/CommonFns.java - About 35 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 removeDotDot has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static int removeDotDot(StringBuffer sb, int j) {
        int k = j;
        while (--k >= 0 && sb.charAt(k) != '/') 
            ;

Severity: Minor
Found in zcommon/src/main/java/org/zkoss/io/Files.java - About 35 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 put has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        public final void put(Element e, Element following) {
            final String name = e.getName();
            List<Element> valueList = _map.computeIfAbsent(name,
                    k -> new LinkedList<>());

Severity: Minor
Found in zcommon/src/main/java/org/zkoss/idom/impl/AbstractGroup.java - About 35 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 myToAnother has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static final Throwable
    myToAnother(Throwable ex, Class<? extends Throwable> targetExceptCls) {
        if (ex instanceof InvocationTargetException)
            ex = ex.getCause(); //might returns UndeclaredThrowableException
        if (ex instanceof UndeclaredThrowableException)
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/lang/Exceptions.java - About 35 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