Showing 4,841 of 7,782 total issues

Method getDynamicMediaURI has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public static String getDynamicMediaURI(AbstractComponent comp, int version, String name, String format) {
        final Desktop desktop = comp.getDesktop();
        if (desktop == null)
            return ""; //no avail at client

Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/impl/Utils.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 browser has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private static boolean browser(String userAgent, String type) {
        if (userAgent == null) //Bug ZK-1582: userAgent could be null if it is robot.
            return false;

        int last = (type = type.trim()).length();
Severity: Minor
Found in zweb/src/main/java/org/zkoss/web/servlet/Servlets.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 getErrorCorrectionLevel has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    getErrorCorrectionLevel: function(a, b) {
        for (var c = 8, d = 928 - b; 0 < c && !(d >= 2 << a);) --c;
        if (0 > a || 8 < a) a = 41 > b ? 2 : 161 > b ? 3 : 321 > b ? 4 : 864 > b ?
            5 : c;
        a > c && (a = c);
Severity: Minor
Found in zktest/src/main/webapp/test2/js/zk-3913-PDF417lib.js - 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 tab$mold$ has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function tab$mold$(out) {
    var tbx = this.getTabbox(),
        uuid = this.uuid,
        icon = this.$s('icon'),
        /*safe*/
Severity: Minor
Found in zul/src/main/resources/web/js/zul/tab/mold/tab.js - 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 constructor has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    constructor(value: number | string) {
        super();
        value = value ? '' + value : '0';
        var jdot = -1;
        for (var j = 0, len = value.length; j < len; ++j) {
Severity: Minor
Found in zk/src/main/resources/web/js/zk/math.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 rounding has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    rounding(valStr: string, ri: number, rounding: number, minus: boolean): string {
        switch (rounding) {
            case 0: //UP
                valStr = up(valStr, ri);
                break;
Severity: Minor
Found in zk/src/main/resources/web/js/zk/fmt/numfmt.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 scrollToElement has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    scrollToElement(dom: HTMLElement): void {
        var cave = this.cave,
            domTop = jq(dom).offset()!.top,
            domBottom = domTop + dom.offsetHeight,
            domLeft = jq(dom).offset()!.left,
Severity: Minor
Found in zul/src/main/resources/web/js/zul/Scrollbar.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 _mousewheelY has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    _mousewheelY(evt: zk.Event, delta: number, deltaX: number, deltaY: number): void {
        if (deltaY) {
            evt.stop();
            var opts = this.opts,
                steps = opts.startStep,
Severity: Minor
Found in zul/src/main/resources/web/js/zul/WScroll.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 _mousewheelX has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    _mousewheelX(evt: zk.Event, delta: number, deltaX: number, deltaY: number): void {
        if (deltaX) {
            evt.stop();
            var opts = this.opts,
                steps = opts.startStep,
Severity: Minor
Found in zul/src/main/resources/web/js/zul/WScroll.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 snap has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function snap(dg: zk.Draggable, pointer: zk.Offset): zk.Offset {
    var x = pointer[0],
        y = pointer[1];
    if (dg._isVer) {
        var move = y;
Severity: Minor
Found in zul/src/main/resources/web/js/zul/WScroll.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

Method processItem has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static final Media processItem(Desktop desktop, FileItem fi, boolean alwaysNative,
            org.zkoss.zk.ui.sys.DiskFileItemFactory factory) throws IOException {
        String name = getBaseName(fi);
        if (name != null) {
            //Not sure whether a name might contain ;jsessionid or similar
Severity: Major
Found in zk/src/main/java/org/zkoss/zk/au/http/AuMultipartUploader.java - About 2 hrs to fix

    Method doValidate has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected boolean doValidate(Component comp, String command, Event evt, BindContext ctx, Set<Property> notifys) {
            final Set<Property> validates = new HashSet<Property>();
            try {
                if (_log.isDebugEnabled()) {
                    _log.debug("doValidate  comp=[{}],command=[{}],evt=[{}],context=[{}]", comp, command, evt, ctx);
    Severity: Major
    Found in zkbind/src/main/java/org/zkoss/bind/impl/BinderImpl.java - About 2 hrs to fix

      Method service has 60 lines of code (exceeds 25 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_DATA_LOADING)) {
                  Events.postEvent(DataLoadingEvent.getDataLoadingEvent(request, preloadSize()));
              } else if (inPagingMold() && cmd.equals(ZulEvents.ON_PAGE_SIZE)) {
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Grid.java - About 2 hrs to fix

        Function domManip has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function domManip( collection, args, callback, ignored ) {
        
            // Flatten any nested arrays
            args = flat( args );
        
        
        Severity: Major
        Found in zk/src/main/resources/web/js/zk/ext/jquery.js - About 2 hrs to fix

          Function checkJavaStyleSetter has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function checkJavaStyleSetter(node: TSESTree.MethodDefinition | TSESTree.TSAbstractMethodDefinition) {
                      const { key, value: functionExpression } = node;
                      if (node.static || key.type !== AST_NODE_TYPES.Identifier) {
                          return;
                      }
          Severity: Major
          Found in eslint-plugin-zk/src/rules/javaStyleSetterSignature.ts - About 2 hrs to fix

            File Objects.java has 266 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* Objects.java
            
            
                Purpose: Utilities related to Object.
                Description:
            Severity: Minor
            Found in zcommon/src/main/java/org/zkoss/lang/Objects.java - About 2 hrs to fix

              Method setContent has 59 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public final Object setContent(Object obj) {
                      if (obj instanceof Item) {
                          getChildren().add((Item)obj);
                          return null; //done
                      }
              Severity: Major
              Found in zcommon/src/main/java/org/zkoss/idom/Element.java - About 2 hrs to fix

                Method MapData has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  final public void MapData() throws ParseException {
                                          /*@bgen(jjtree) MapData */
                  AstMapData jjtn000 = new AstMapData(JJTMAPDATA);
                  boolean jjtc000 = true;
                  jjtree.openNodeScope(jjtn000);
                Severity: Major
                Found in zel/src/main/java/org/zkoss/zel/impl/parser/ELParser.java - About 2 hrs to fix

                  Method SetData has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    final public void SetData() throws ParseException {
                                            /*@bgen(jjtree) SetData */
                    AstSetData jjtn000 = new AstSetData(JJTSETDATA);
                    boolean jjtc000 = true;
                    jjtree.openNodeScope(jjtn000);
                  Severity: Major
                  Found in zel/src/main/java/org/zkoss/zel/impl/parser/ELParser.java - About 2 hrs to fix

                    Method MethodParameters has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      final public void MethodParameters() throws ParseException {
                                                                 /*@bgen(jjtree) MethodParameters */
                      AstMethodParameters jjtn000 = new AstMethodParameters(JJTMETHODPARAMETERS);
                      boolean jjtc000 = true;
                      jjtree.openNodeScope(jjtn000);
                    Severity: Major
                    Found in zel/src/main/java/org/zkoss/zel/impl/parser/ELParser.java - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language