Showing 4,841 of 7,782 total issues

Method getRequestDispatcher has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public static final RequestDispatcher getRequestDispatcher(ServletContext ctx, ServletRequest request, String uri,
            Map params, int mode) throws ServletException {
        final char cc = uri.length() > 0 ? uri.charAt(0) : (char) 0;
        if (ctx == null || (cc != '/' && cc != '~')) { //... or relevant
            if (request == null)
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/Servlets.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 beforeSize has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        beforeSize(this: zk.Widget, ctl: unknown, opts: unknown, cleanup: boolean): void {
            let wgt = this, p;
            if (cleanup)
                wgt.clearCachedSize_();
Severity: Minor
Found in zk/src/main/resources/web/js/zk/flex.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 beforeSend has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        export function beforeSend(uri: string, aureq: zk.Event, dt?: zk.Desktop): string {
            var target: zk.Widget | undefined, tag: string | undefined;
            if ((target = aureq.target) && (tag = target.autag)) {
                tag = '/' + encodeURIComponent(tag);
                if (!uri.includes('/_/')) {
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 toJSON has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        export function toJSON(
            target: zk.Widget | undefined,
            data: // `pageX` and `pageY` should co-exist
                | { pageX: number; pageY: number; x?: number; y?: number; z$dateKeys?: string[] }
                | { pageX?: undefined; pageY?: undefined; x?: number; y?: number; z$dateKeys?: string[] }
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 _rmDesktop has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        export function _rmDesktop(dt: zk.Desktop, dummy?: boolean): void {
            var url = zk.ajaxURI(undefined, { desktop: dt, au: true }),
                data = jq.param({
                    dtid: dt.id,
                    cmd_0: dummy ? 'dummy' : 'rmDesktop',
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 pushReqCmds has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        export function pushReqCmds(reqInf: AuRequestInfo, response: AuResponse): boolean {
            var dt = reqInf.dt,
                rt = response.responseText;
            if (!rt) {
                if (zk.pfmeter) zAu._pfdone(dt, zAu.pfGetIds(response));
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 unAfter has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    unAfter(cmd: string, fn: CallableFunction): this {
        var ac = this._aftercmd![cmd];
        for (var j = ac ? ac.length : 0; j--;) {
            if (ac[j] == fn) {
                if (!this._processingAfterCommand)
Severity: Minor
Found in zkbind/src/main/resources/web/js/zkbind/Binder.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 _aftCreate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function _aftCreate(wgt: zk.Widget | undefined, cwgts: zk.Widget[], node: HTMLElement, opts?: {replaceHTML?}): undefined | zk.Widget | zk.Widget[] {
    let c: zk.Widget | undefined;
    if (!wgt || !(c = wgt.firstChild))
        return undefined;

Severity: Minor
Found in zk/src/main/resources/web/js/zk/zuml/Parser.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

Method FillBuff has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  protected void FillBuff() throws java.io.IOException
  {
    if (maxNextCharInd == available)
    {
      if (available == bufsize)
Severity: Minor
Found in zel/src/main/java/org/zkoss/zel/impl/parser/SimpleCharStream.java - About 1 hr to fix

    Method createNodeInternal has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private static final Node createNodeInternal(String expr)
                throws ELException {
            if (expr == null) {
                throw new ELException(MessageFactory.get("error.null"));
            }
    Severity: Minor
    Found in zel/src/main/java/org/zkoss/zel/impl/lang/ExpressionBuilder.java - About 1 hr to fix

      Method getItemRenderer has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public ListitemRenderer<Object> getItemRenderer() {
      
              return new ListitemRenderer<Object>() {
                  @Override
                  public void render(Listitem listitem, Object obj, int index) {

        Method level1Nodes has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @SuppressWarnings("unchecked")
            private List<TreeNode<String>> level1Nodes() {
                return Arrays.asList(
                    newNode("node 1", 
                        newNode("node 1.1", 
        Severity: Minor
        Found in zktest/src/main/java/org/zkoss/zktest/test2/B70_ZK_2764_3.java - About 1 hr to fix

          Method buildNextShadowCtx has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private ComponentMatchCtx buildNextShadowCtx() {
                  Component comp = _currCtx.getComponent();
                  boolean isShadow = comp instanceof ShadowElement;
                  Component child = getNextUntrackedChild(comp);
                  if (!isShadow) {
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/select/impl/ComponentIterator.java - About 1 hr to fix

            Method beforeChildAdded has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public void beforeChildAdded(Component child, Component refChild) {
                    if (!(child instanceof ShadowElement))
                        throw new UiException("Unsupported child for shadow element: " + child);
                    if (refChild != null && !(refChild instanceof ShadowElement))
                        throw new UiException("Unsupported refChild for shadow element: " + refChild);
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 1 hr to fix

              Method parseZk has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static ZkInfo parseZk(NodeInfo parent, Element el, AnnotationHelper annHelper) throws Exception {
                      if (annHelper.clear())
                          log.warn(message("Annotations are ignored since <zk> doesn't support them", el));
              
                      final ZkInfo zi = new ZkInfo(parent, null);
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 1 hr to fix

                Method adjustInsertionForInsertBefore has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private boolean adjustInsertionForInsertBefore(HtmlShadowElement se, Component target, Component insertBefore) {
                        Component old = null;
                        Direction direction = inRange(se, insertBefore);
                        switch (direction) {
                        case PREVIOUS:
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/ui/HtmlShadowElement.java - About 1 hr to fix

                  Method setId has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public void setId(String id) {
                          if (id == null)
                              id = "";
                          if (!id.equals(_id)) {
                              final boolean rawId = this instanceof RawId;
                  Severity: Minor
                  Found in zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java - About 1 hr to fix

                    Method getNativeContent has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private static final void getNativeContent(CreateInfo ci, StringBuffer sb, Component comp, List<NodeInfo> children,
                                Native.Helper helper) {
                            for (NodeInfo meta : children) {
                                if (meta instanceof NativeInfo) {
                                    final NativeInfo childInfo = (NativeInfo) meta;
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiEngineImpl.java - About 1 hr to fix

                      Method wait has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public void wait(Object mutex) throws InterruptedException, SuspendNotAllowedException {
                              if (mutex == null)
                                  throw new IllegalArgumentException("null mutex");
                      
                              final Thread thd = Thread.currentThread();
                      Severity: Minor
                      Found in zk/src/main/java/org/zkoss/zk/ui/impl/UiEngineImpl.java - About 1 hr to fix

                        Method getType has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                private static Type getType(final char[] buf, final int off) {
                                    int len;
                                    switch (buf[off]) {
                                        case 'V':
                                            return VOID_TYPE;
                          Severity
                          Category
                          Status
                          Source
                          Language