Showing 4,841 of 7,782 total issues

Method forFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static <A extends Annotation> void forFields(Class<?> clazz, Class<A> annotationClass,
            FieldRunner<A> runner) {
        for (Class<?> c = clazz; c != null; c = c.getSuperclass()) {
            for (Field f : c.getDeclaredFields()) {
                A anno = f.getAnnotation(annotationClass);
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/select/impl/Reflections.java - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    public final void init(FilterConfig config) throws ServletException {
        _ctx = config.getServletContext();

        String param = config.getInitParameter("extension");
        if (param != null && param.length() > 0)
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/http/DHtmlLayoutFilter.java - About 25 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 evaluate0 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private Object evaluate0(Object self, String expr, Class<?> expectedType, Page page) {
        if (expr == null || expr.length() == 0 || expr.indexOf("${") < 0) {
            if (expectedType == Object.class || expectedType == String.class)
                return expr;
            return Classes.coerce(expectedType, expr);
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/http/ExecutionImpl.java - About 25 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 isWpdContentRequired has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private boolean isWpdContentRequired(String pkg, Element root) {
        for (LanguageDefinition langdef : LanguageDefinition.getByDeviceType(getDeviceType()))
            if (langdef.getJavaScriptPackagesWithMerges().contains(pkg)) return true;

        for (Iterator it = root.getElements("script").iterator(); it.hasNext();) {
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/http/WpdExtendlet.java - About 25 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 addLanguage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static void addLanguage(Locator locator, URL url) {
        if (locator == null || url == null)
            throw new IllegalArgumentException("null");

        if (_loaded) {
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java - About 25 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 findExact has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static Method findExact(final Method[] mtds, final Object val) {
        if (val != null) {
            final Class vcls = val.getClass();
            for (int j = 0; j < mtds.length; ++j)
                if (vcls.equals(mtds[j].getParameterTypes()[0]))
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Property.java - About 25 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 removeSclass has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public void removeSclass(String cssClass) {
        String sclass = getSclass();
        if (sclass != null) {
            String[] input = cssClass.split(" ");
            String cur = " " + sclass + " ";
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/HtmlBasedComponent.java - About 25 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 locateClass has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    @SuppressWarnings("unchecked")
    private static <T> Class<? extends T> locateClass(String clsnm, Class<?>... clses) throws Exception {
        final Class<?> c = Classes.forNameByThread(clsnm, false); // check only for ZK-5257
        if (clses != null)
            for (Class<?> cls : clses)
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java - About 25 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 doFilter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
            throws IOException, ServletException {
        if (request instanceof HttpServletRequest) {
            HttpServletRequest reg = (HttpServletRequest) request;
            HttpServletResponse resp = (HttpServletResponse) response;
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/http/RichletFilter.java - About 25 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 setRootAttribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public void setRootAttribute(String name, String value) {
        if (name == null || name.length() == 0)
            throw new IllegalArgumentException();

        if (_rootAttrs == null) {
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/PageDefinition.java - About 25 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 resolveImplementationClass has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public Class<?> resolveImplementationClass(Page page, String clsnm) throws ClassNotFoundException {
        final Object cls = clsnm != null ? clsnm : _implcls;
        if (cls instanceof String) {
            clsnm = (String) cls;
            final Class<?> found = page != null ? page.resolveClass(clsnm) : Classes.forNameByThread(clsnm);

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

    public String getWidgetClass(Component comp, String moldName) {
        if (_molds != null) {
            final ExValue wc = _molds.get(moldName);
            if (wc != null) {
                final String s = (String) wc.getValue(_evalr, comp);

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

    public Object getValue(Component comp) {
        if (_value != null)
            return _value.getValue(_evalr, comp);

        Desktop desktop = comp.getDesktop();
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Property.java - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    private void init(LanguageDefinition langdef, PageDefinition pgdef, String name, Object cls) {
        if (name == null)
            throw new IllegalArgumentException();
        if (langdef != null && pgdef != null)
            throw new IllegalArgumentException("langdef and pgdef cannot both null or both non-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 addAddon has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static void addAddon(Locator locator, URL url) {
        if (locator == null || url == null)
            throw new IllegalArgumentException("null");

        if (_loaded) {
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java - About 25 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 newInstance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public Component newInstance(Class<? extends Component> cls) {
        final Object curInfo = ComponentsCtrl.getCurrentInfo();
        boolean bSet = true;
        if (curInfo instanceof ComponentInfo) {
            bSet = ((ComponentInfo) curInfo).getComponentDefinition() != this;

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

    public List<String> getAnnotatedProperties() {
        final List<String> list = new LinkedList<String>();
        if (_annots != null) {
            for (String propName : _annots.keySet()) {
                if (propName != null)
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/AnnotationMap.java - About 25 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 dupProps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private void dupProps(ComponentInfo compInfo) {
        if (compInfo._annots != null)
            _annots = (AnnotationMap) compInfo._annots.clone();
        if (compInfo._props != null)
            _props = new LinkedList<Property>(compInfo._props);
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java - About 25 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 getAnnotations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public Collection<Annotation> getAnnotations(String propName) {
        if (_annots != null) {
            final Map<String, List<Annotation>> anmap = _annots.get(propName);
            if (anmap != null) {
                final List<Annotation> dst = new LinkedList<Annotation>();
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/AnnotationMap.java - About 25 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 getAnnotations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public Collection<Annotation> getAnnotations(String propName, String annotName) {
        if (_annots != null) {
            final Map<String, List<Annotation>> anmap = _annots.get(propName);
            if (anmap != null) {
                List<Annotation> ans = anmap.get(annotName);
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/AnnotationMap.java - About 25 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