Showing 4,841 of 7,782 total issues

Method addResponse has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public void addResponse(String key, AuResponse response, int priority) {
        if (response == null)
            throw new IllegalArgumentException();

        //relative fix BUG ZK-1464
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiVisualizer.java - About 2 hrs 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 processEvent has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public boolean processEvent(Desktop desktop, Component comp, Event event) {
        if (Thread.currentThread() instanceof EventProcessingThreadImpl)
            throw new IllegalStateException("processEvent cannot be called in an event thread");
        if (_ceased != null)
            throw new InternalError("The event thread has beeing stopped. Cause: " + _ceased);
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/impl/EventProcessingThreadImpl.java - About 2 hrs 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 createComponents has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public Component[] createComponents(Execution exec, PageDefinition pagedef, Page page, Component parent,
            Component insertBefore, VariableResolver resolver, Map<?, ?> arg) {
        if (pagedef == null)
            throw new IllegalArgumentException("pagedef");

Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiEngineImpl.java - About 2 hrs 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 getFromScope has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

        protected Object getFromScope(String name) {
            final Scope curr = getCurrent();
            if (curr == null) //no scope allowed
                return getImplicit(name);

Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/scripting/bsh/BSHInterpreter.java - About 2 hrs 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 createKey has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public static Object createKey(Object obj) {
        if (obj == null) {
            return NULL;
        }
        if (!obj.getClass().isArray()) {
Severity: Minor
Found in zkbind/src/main/java/org/zkoss/bind/impl/KeyFactory.java - About 2 hrs 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 initFormBean has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public <T> Form initFormBean(Object bean, Class<Object> class1, BindContext bindContext) {
        Form form = ((BinderCtrl) getBinder()).getForm(getComponent(), _formId);
        if (form == null) {
            Class[] interfaces = null;

Severity: Minor
Found in zkbind/src/main/java/org/zkoss/bind/impl/FormBindingImpl.java - About 2 hrs 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 setModel has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public void setModel(ListModel<?> model) {
        if (model != null) {
            if (!(model instanceof Selectable))
                throw new UiException(model.getClass() + " must implement " + Selectable.class);

Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/Combobox.java - About 2 hrs 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 service has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public void service(org.zkoss.zk.au.AuRequest request, boolean everError) {
        final String cmd = request.getCommand();
        if (cmd.equals(Events.ON_OPEN)) {
            OpenEvent evt = OpenEvent.getOpenEvent(request);
            _open = evt.isOpen();
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/Group.java - About 2 hrs 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 insertBefore has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public boolean insertBefore(Component child, Component refChild) {
        if (child instanceof Tabs) {
            if (super.insertBefore(child, refChild)) {
                _tabs = (Tabs) child;
                for (Iterator<Component> it = _tabs.getChildren().iterator(); it.hasNext();) {
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/Tabbox.java - About 2 hrs 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 21 (exceeds 5 allowed). Consider refactoring.
Open

    private void afterUnmarshal(int cnt) {
        for (Iterator<Component> it = getChildren().iterator(); it.hasNext();) {
            final Object child = it.next();
            if (child instanceof Tabs) {
                _tabs = (Tabs) child;
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/Tabbox.java - About 2 hrs 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 renderWith has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    private void renderWith(ActionContext ac, Status st, String txt) throws DspException, IOException {
        final StringBuffer sb = new StringBuffer();
        int idx = 0;
        final StringWriter out = getFragmentOut(ac, _trim);
        for (int j = _beg, len = txt.length(); j < len && j <= _end; ++j) {
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/dsp/action/ForEach.java - About 2 hrs 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 isScrollIntoView has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    isScrollIntoView(recursive?: boolean): boolean {// ZK-2069: can check whether the element is shown in parents' viewport.
        var vOffset = this.viewportOffset(),
            x = vOffset[0],
            y = vOffset[1],
            w = this.jq[0].offsetWidth,
Severity: Minor
Found in zk/src/main/resources/web/js/zk/dom.ts - About 2 hrs 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 parseMap has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

        static parseMap(text: string, separator?: string, quote?: string): Record<string, string> {
            var map = {};
            if (text) {
                var ps = text.split(separator || ',');
                if (quote) {
Severity: Minor
Found in zk/src/main/resources/web/js/zk/utl.ts - About 2 hrs 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 _matchMedia has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

function _matchMedia(event: MediaQueryListEvent | MediaQueryList, binder: Binder, value: string): void {
    var cookies = binder._cookies!;
    if (event.matches) {
        var orient = '',
            dpr = 1;
Severity: Minor
Found in zkbind/src/main/resources/web/js/zkbind/Binder.ts - About 2 hrs 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

File B70_ZK_2779_ViewModel.java has 288 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package org.zkoss.zktest.test2;

import java.util.ArrayList;
import java.util.List;

    Method subtract has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static final long
        subtract(Date date2, TimeZone tz, int field, Date date1) {
            if (tz == null)
                tz = TimeZones.getCurrent();
    
    
    Severity: Major
    Found in zcommon/src/main/java/org/zkoss/util/Dates.java - About 2 hrs to fix

      Method process has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected boolean process(Session sess, HttpServletRequest request, HttpServletResponse response, String originPath,
                  boolean bRichlet) throws ServletException, IOException {
      
              // Fix Server-Side Request Forgery (SSRF)
              String path = Https.sanitizePath(originPath);
      Severity: Major
      Found in zk/src/main/java/org/zkoss/zk/ui/http/DHtmlLayoutServlet.java - About 2 hrs to fix

        Method parse has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public PageDefinition parse(Document doc, String extension) throws Exception {
                //1. parse the page and import directive if any
                final List<ProcessingInstruction> pis = new LinkedList<ProcessingInstruction>();
                final List<String[]> imports = new LinkedList<String[]>();
                final List<String> impclses = new LinkedList<String>();
        Severity: Major
        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 2 hrs to fix

          Method doActivate has 72 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static UiVisualizer doActivate(Execution exec, boolean asyncupd, boolean recovering,
                      Object[] resultOfRepeat, int timeout) {
                  if (Executions.getCurrent() != null)
                      throw new IllegalStateException("Use doReactivate instead");
                  //        assert !recovering || !asyncupd; //Not support both asyncupd and recovering are true yet
          Severity: Major
          Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiEngineImpl.java - About 2 hrs to fix

            Method tieValue has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected void tieValue(ELContext elCtx, Object base, Object property, Object value, boolean allownotify) {
                    //in order to support more complex case, ex: .stream().filter(x -> x.contains(vm.value))
                    final BindELContext ctx;
                    ELContext ec = ((EvaluationContext) elCtx).getELContext();
                    if (ec instanceof BindELContext)
            Severity: Major
            Found in zkbind/src/main/java/org/zkoss/bind/xel/zel/BindELResolver.java - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language