Showing 4,841 of 7,782 total issues

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

    public void addAll(EventHandlerMap src) {
        if (src != null && !src.isEmpty()) {
            for (Map.Entry<String, List<EventHandler>> me : src._evthds.entrySet()) {
                final String evtnm = me.getKey();
                for (EventHandler eh : me.getValue())
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/EventHandlerMap.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 getCurrent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static final Scope getCurrent(Page page) {
        final List<Scope> nss = _scopes.get();
        final Scope scope = nss != null && !nss.isEmpty() ? nss.get(0) : null;
        if (scope != null)
            return scope;
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/ext/Scopes.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 getScope has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static final int getScope(String scope) {
        if ("component".equals(scope))
            return Component.COMPONENT_SCOPE;
        if ("space".equals(scope))
            return Component.SPACE_SCOPE;
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/Components.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 isDynamicValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected boolean isDynamicValue(String propName) {
        final ComponentCtrl compCtrl = this;
        Collection<Annotation> annos = compCtrl.getAnnotations(propName);
        if (!annos.isEmpty()) {
            for (Annotation anno : annos) {
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 setParent0 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private void setParent0(Component parent) {
        if (_host != null && parent != null) {
            throw new UiException("As a shadow root cannot be a child of a shadow element.");
        }
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 mergeToHost has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public boolean mergeToHost(Component host) {
        if (host == null)
            throw new UiException("The host cannot be null.");
        if (host == _host)
            return false; // nothing to do
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.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 isShadowElement has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static final boolean isShadowElement(LanguageDefinition langdef, PageDefinition pgdef, String nm,
            String pref, String uri, boolean bNativeContent) {
        // feature in 8.0.0, no need to check namespace, if any.
        if ("true".equalsIgnoreCase(Library.getProperty("org.zkoss.zk.namespace.tolerant", "false")))
            return langdef.hasShadowDefinition(nm) || (!"xul/html".equals(langdef.getName())
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.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 getAttribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public Object getAttribute(String name, boolean recurse) {
        Object val = getAttribute(name);
        if (val != null || !recurse || hasAttribute(name))
            return val;

Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 afterComponentPageChanged has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private void afterComponentPageChanged(Page newpg, Page oldpg) {
        if (newpg == oldpg) {
            // Orphan case: detached again after the parent was detached
            if (getParent() == null && oldpg == null) {
                WebApps.getCurrent().getConfiguration().afterComponentDetached(this, null);
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 getAttribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public Object getAttribute(String name, boolean recurse) {
        Object val = getAttribute(name);
        if (val != null || !recurse || hasAttribute(name))
            return val;
        if (_sess != null)
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/impl/DesktopImpl.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 setTemplate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public Template setTemplate(String name, Template template) {
        if (template == null) {
            return _auxinf != null && _auxinf.templates != null ? _auxinf.templates.remove(name) : null;
        } else {
            AuxInfo auxinf = initAuxInfo();
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 getDownloadMediaURI has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public String getDownloadMediaURI(Media media, String pathInfo) {
        if (media == null)
            throw new IllegalArgumentException("null media");

        if (_meds == null) {
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/impl/DesktopImpl.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 findNearestShadow has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private HtmlShadowElement findNearestShadow(HtmlShadowElement current, Component baseChild) {
        List<ShadowElement> list = cast(current.getChildren());
        for (ShadowElement sh : list) {
            if (sh instanceof HtmlShadowElement) {
                HtmlShadowElement shadow0 = (HtmlShadowElement) sh;
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 setClientAttribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public String setClientAttribute(String name, String value) {
        if (name == null)
            throw new IllegalArgumentException();

        final String old;
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 addSharedEventHandlerMap has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public void addSharedEventHandlerMap(EventHandlerMap evthds) {
        if (evthds != null && !evthds.isEmpty()) {
            unshareEventHandlerMap(false);
            if (initAuxInfo().evthds == null) {
                _auxinf.evthds = evthds;
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.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 static void init(Map<String, Component> fellows, Component comp) {
        if (!(comp instanceof NonFellow)) {
            final String compId = comp.getId();
            if (!AbstractComponent.isAutoId(compId))
                fellows.put(compId, comp);
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/VirtualIdSpace.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 afterComponentDetached has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public void afterComponentDetached(Component comp, Page prevpage) {
        if (_uiCycles != null) {
            for (Iterator<UiLifeCycle> it = new LinkedList<UiLifeCycle>(_uiCycles).iterator(); it.hasNext();) {
                final UiLifeCycle listener = it.next();
                try {
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/impl/DesktopImpl.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 resolveFunction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        public Function resolveFunction(String prefix, String name) throws XelException {
            if (_mappers != null) {
                for (Iterator<FunctionMapper> it = CollectionsX.comodifiableIterator(_mappers); it.hasNext();) {
                    final Function f = it.next().resolveFunction(prefix, name);
                    if (f != null)
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.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 beforeSendEvent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public Event beforeSendEvent(Event event) {
        final EventInterceptor[] eis = _eis;
        if (eis != null) {
            for (int j = 0; j < eis.length; ++j) {
                event = eis[j].beforeSendEvent(event);
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/impl/EventInterceptors.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 removeListener0 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private boolean removeListener0(List list, Object listener) {
        //Since 3.0.6: To be consistent with Configuration,
        //use equals instead of ==
        if (list != null && listener != null)
            for (Iterator it = list.iterator(); it.hasNext();) {
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/impl/DesktopImpl.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