Showing 4,841 of 7,782 total issues

Function _checkBarRequired has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    _checkBarRequired(): void {
        var cave = this.cave,
            scroller = this.scroller,
            frozen = this.widget.frozen;
        //check if horizontal scroll-bar required
Severity: Minor
Found in zul/src/main/resources/web/js/zul/Scrollbar.ts - About 3 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 create has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    create(context) {
        const sourceCode = context.getSourceCode();
        function checkJavaStyleSetter(node: TSESTree.MethodDefinition | TSESTree.TSAbstractMethodDefinition) {
            const { key, value: functionExpression } = node;
            if (node.static || key.type !== AST_NODE_TYPES.Identifier) {
Severity: Minor
Found in eslint-plugin-zk/src/rules/javaStyleSetterSignature.ts - About 3 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 unescape has 97 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    static void unescape(final char[] text, final int offset, final int len, final Writer writer)
                         throws IOException {

        if (text == null) {
            return;
Severity: Major
Found in zcommon/src/main/java/org/zkoss/lang/JavaScriptEscapeUtil.java - About 3 hrs to fix

    Method equals has 97 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static final boolean equals(Object a, Object b) {
            if (a == b || (a != null && b != null && a.equals(b)))
                return true;
            if ((a instanceof BigDecimal) && (b instanceof BigDecimal))
                return ((BigDecimal)a).compareTo((BigDecimal) b) == 0;
    Severity: Major
    Found in zcommon/src/main/java/org/zkoss/lang/Objects.java - About 3 hrs to fix

      Method assign0 has 97 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private void assign0(Component comp) throws Exception {
              if (comp instanceof ComponentCtrl) {
                  ComponentCtrl ctrl = ((ComponentCtrl) comp);
                  PropertyAccess propertyAccess = ctrl.getPropertyAccess(_name);
                  if (propertyAccess != null) {
      Severity: Major
      Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Property.java - About 3 hrs to fix

        Method insertBefore has 97 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public boolean insertBefore(Component newChild, Component refChild) {
                if (newChild instanceof Listitem) {
                    final boolean isReorder = newChild.getParent() == this;
                    //bug #3051305: Active Page not update when drag & drop item to the end
                    if (isReorder) {
        Severity: Major
        Found in zul/src/main/java/org/zkoss/zul/Listbox.java - About 3 hrs to fix

          Function superMatcher has 97 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  superMatcher = function( seed, context, xml, results, outermost ) {
                      var elem, j, matcher,
                          matchedCount = 0,
                          i = "0",
                          unmatched = seed && [],
          Severity: Major
          Found in zk/src/main/resources/web/js/zk/ext/jquery.js - About 3 hrs to fix

            Function applyCSSFlex has 97 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    applyCSSFlex(this: zk.Widget): void {
                        const wgt = this;
                        if (!wgt._nvflex && !wgt._nhflex)
                            return;
            
            Severity: Major
            Found in zk/src/main/resources/web/js/zk/flex.ts - About 3 hrs to fix

              Method outLangJavaScripts has 96 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static final String outLangJavaScripts(Execution exec, WebApp wapp, String deviceType) {
                      if (exec.isAsyncUpdate(null) || exec.getAttribute(ATTR_LANG_JS_GENED) != null)
                          return ""; //nothing to generate
                      exec.setAttribute(ATTR_LANG_JS_GENED, Boolean.TRUE);
              
              
              Severity: Major
              Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java - About 3 hrs to fix

                Function trigger has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    trigger: function( event, data, elem, onlyHandlers ) {
                
                        var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
                            eventPath = [ elem || document ],
                            type = hasOwn.call( event, "type" ) ? event.type : event,
                Severity: Major
                Found in zk/src/main/resources/web/js/zk/ext/jquery.js - About 3 hrs to fix

                  Function sanitize has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      DOMPurify.sanitize = function (dirty) {
                        let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
                        let body = null;
                        let importedNode = null;
                        let currentNode = null;
                  Severity: Major
                  Found in zk/src/main/resources/web/js/zk/ext/purify.js - About 3 hrs to fix

                    Function Animation has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function Animation( elem, properties, options ) {
                        var result,
                            stopped,
                            index = 0,
                            length = Animation.prefilters.length,
                    Severity: Major
                    Found in zk/src/main/resources/web/js/zk/ext/jquery.js - About 3 hrs to fix

                      HtmlNativeComponent has 31 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      public class HtmlNativeComponent extends AbstractComponent implements DynamicTag, Native { //cannot be RawId since two native might have the same ID
                          private static final Helper _helper = new HtmlHelper();
                          private static final String ATTR_RENDER_CONTEXT = "org.zkoss.zk.native.renderContext";
                      
                          //---------
                      Severity: Minor
                      Found in zk/src/main/java/org/zkoss/zk/ui/HtmlNativeComponent.java - About 3 hrs to fix

                        SimpleWebApp has 31 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        public class SimpleWebApp extends AbstractWebApp {
                            private ServletContext _ctx;
                            private final ScopeListeners _scopeListeners = new ScopeListeners(this);
                        
                            public SimpleWebApp() {
                        Severity: Minor
                        Found in zk/src/main/java/org/zkoss/zk/ui/http/SimpleWebApp.java - About 3 hrs to fix

                          BSHInterpreter has 31 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          public class BSHInterpreter extends GenericInterpreter implements SerializableAware, HierarchicalAware {
                              /*package*/ static final Logger log = LoggerFactory.getLogger(BSHInterpreter.class);
                          
                              /** A variable in {@link Scope}. The value is an instance of
                               * BeanShell's NameSpace.
                          Severity: Minor
                          Found in zk/src/main/java/org/zkoss/zk/scripting/bsh/BSHInterpreter.java - About 3 hrs to fix

                            ListModelMap has 31 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                            public class ListModelMap<K, V> extends AbstractListModel<Map.Entry<K, V>>
                                    implements Sortable<Map.Entry<K, V>>, Map<K, V>, java.io.Serializable {
                                private static final long serialVersionUID = 20120206122736L;
                            
                                protected Map<K, V> _map;
                            Severity: Minor
                            Found in zul/src/main/java/org/zkoss/zul/ListModelMap.java - About 3 hrs to fix

                              RequestXelResolver has 31 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                              public abstract class RequestXelResolver implements VariableResolver {
                                  private final ServletContext _ctx;
                                  private final ServletRequest _request;
                                  private final ServletResponse _response;
                                  private HttpSession _sess;
                              Severity: Minor
                              Found in zweb/src/main/java/org/zkoss/web/servlet/xel/RequestXelResolver.java - About 3 hrs to fix

                                Method retrieve has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected byte[] retrieve(HttpServletRequest request, HttpServletResponse response, String path)
                                            throws ServletException, IOException {
                                        byte[] data;
                                        String pkg = null;
                                        boolean sourceMapEnabled = sourceMapEnabled();
                                Severity: Major
                                Found in zk/src/main/java/org/zkoss/zk/ui/http/WpdExtendlet.java - About 3 hrs to fix

                                  Function _sprintf has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      _sprintf: function() {
                                          var a = arguments,
                                              b = 0,
                                              c = function(a, b, c, d) {
                                                  c || (c = " ");
                                  Severity: Major
                                  Found in zktest/src/main/webapp/test2/js/zk-3913-PDF417lib.js - About 3 hrs to fix

                                    File HtmlNativeComponent.java has 324 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    /* HtmlNativeComponent.java
                                    
                                        Purpose:
                                    
                                        Description:
                                    Severity: Minor
                                    Found in zk/src/main/java/org/zkoss/zk/ui/HtmlNativeComponent.java - About 3 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language