Showing 7,775 of 7,775 total issues

Method remove has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public V remove(Object key) {
        if (key == null) {
            key = KeyFactory.NULL;
        }

Severity: Minor
Found in zkbind/src/main/java/org/zkoss/bind/impl/WeakIdentityMap.java - About 1 hr to fix

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

        public boolean insertBefore(Component newChild, Component refChild) {
            if (newChild instanceof Treecols) {
                if (super.insertBefore(newChild, refChild)) {
                    _treecols = (Treecols) newChild;
                    return true;
    Severity: Minor
    Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 1 hr to fix

      Method compare has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public int compare(Object o1, Object o2) {
              if (_index < 0 && _column != null) //decide the index
                  _index = _column.getParent().getChildren().indexOf(_column);
      
              Object v1, v2;
      Severity: Minor
      Found in zul/src/main/java/org/zkoss/zul/RowComparator.java - About 1 hr to fix

        Function squarify has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function squarify(node) {
            var children = node.children;
            if (children && children.length) {
              var rect = pad(node),
                  row = [],
        Severity: Minor
        Found in zktest/src/main/webapp/js/d3.layout.js - About 1 hr to fix

          Function handler has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  handler: function( event ) {
                      var notAsync, result,
                          saved = dataPriv.get( this, type );
          
                      if ( ( event.isTrigger & 1 ) && this[ type ] ) {
          Severity: Minor
          Found in zk/src/main/resources/web/js/zk/ext/jquery.js - About 1 hr to fix

            Function _initDocument has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                const _initDocument = function _initDocument(dirty) {
                  /* Create a HTML document */
                  let doc = null;
                  let leadingWhitespace = null;
                  if (FORCE_BODY) {
            Severity: Minor
            Found in zk/src/main/resources/web/js/zk/ext/purify.js - About 1 hr to fix

              Function pushReqCmds has 32 lines of code (exceeds 25 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

                Function onURLChange has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    onURLChange(): void { //called by mount.js
                        try {
                            const ifr = window.frameElement as HTMLIFrameElement;
                            if (!parent || parent == window || !ifr) //not iframe
                                return;
                Severity: Minor
                Found in zk/src/main/resources/web/js/zk/bookmark.ts - About 1 hr to fix

                  Function _cmOffset has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function _cmOffset(el: HTMLElement): zk.Offset {
                      var t = 0, l = 0, operaBug;
                      //Fix gecko difference, the offset of gecko excludes its border-width when its CSS position is relative or absolute
                      if (zk.gecko) {
                          var p = el.parentElement;
                  Severity: Minor
                  Found in zk/src/main/resources/web/js/zk/dom.ts - About 1 hr to fix

                    Function _keyDataKey has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        _keyDataKey(this: JQuery.KeyboardEventBase): string {
                            // Ref: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values
                            var key = this.originalEvent!.key;
                            switch (key) {
                                case 'Scroll': return 'ScrollLock';
                    Severity: Minor
                    Found in zk/src/main/resources/web/js/zk/dom.ts - About 1 hr to fix

                      Function create has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          create(context) {
                              function checkBooleanTypeSyntax(node: TSESTree.TSTypeAnnotation | TSESTree.TSTypeAssertion | TSESTree.TSAsExpression) {
                                  if (node.typeAnnotation.type === AST_NODE_TYPES.TSUnionType) {
                                      let booleanType:  TSESTree.TSBooleanKeyword | null | undefined;
                                      for (const t of node.typeAnnotation.types) {
                      Severity: Minor
                      Found in eslint-plugin-zk/src/rules/preferStrictBooleanType.ts - About 1 hr to fix

                        Function create has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            create(context) {
                                return {
                                    CallExpression(node) {
                                        const { callee } = node;
                                        if (callee.type !== AST_NODE_TYPES.MemberExpression ||
                        Severity: Minor
                        Found in eslint-plugin-zk/src/rules/preferNativeClass.ts - About 1 hr to fix

                          Identical blocks of code found in 2 locations. Consider refactoring.
                          Open

                              public void submitToOrigin(BindContext ctx) {
                                  Collection<E> origin = ((Collection<E>) getOriginObject());
                                  origin.clear();
                                  for (E e : _cache) {
                                      if (e instanceof FormProxyObject) {
                          zkbind/src/main/java/org/zkoss/bind/proxy/ListModelListProxy.java on lines 436..449

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 86.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Identical blocks of code found in 2 locations. Consider refactoring.
                          Open

                              public void submitToOrigin(BindContext ctx) {
                                  Collection<E> origin = ((Collection<E>) getOriginObject());
                                  origin.clear();
                                  for (E e : _cache) {
                                      if (e instanceof FormProxyObject) {
                          zkbind/src/main/java/org/zkoss/bind/proxy/ListModelSetProxy.java on lines 366..379

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 86.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                                  try {
                                      if (_log.isDebugEnabled()) {
                                          _log.debug(getSaveBindingDebugInfo("doSaveFormBinding", comp, binding, command, evt, notifys));
                                      }
                                      doPrePhase(Phase.SAVE_BINDING, ctx);
                          zkbind/src/main/java/org/zkoss/bind/impl/PropertyBindingHandler.java on lines 109..119

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 86.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                                  try {
                                      if (_log.isDebugEnabled()) {
                                          _log.debug(getSaveBindingDebugInfo("doSavePropertyBinding", comp, binding, command, evt, notifys));
                                      }
                                      doPrePhase(Phase.SAVE_BINDING, ctx);
                          zkbind/src/main/java/org/zkoss/bind/impl/FormBindingHandler.java on lines 108..118

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 86.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Method equals has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                                  public boolean equals(Object o) {
                                      if (this == o) return true;
                                      if (!(o instanceof Map.Entry))
                                          return false;
                                      Map.Entry e = (Map.Entry)o;
                          Severity: Minor
                          Found in zcommon/src/main/java/org/zkoss/util/FilterMap.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

                          Method getContentType has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static final String getContentType(String format) {
                                  if (format == null)
                                      return null;
                          
                                  format = format.trim().toLowerCase(java.util.Locale.ENGLISH);
                          Severity: Minor
                          Found in zcommon/src/main/java/org/zkoss/util/media/ContentTypes.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

                          Method indexOfUnderline has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static int indexOfUnderline(String s, int j) {
                                  int k, last = s.length() - 2;
                                  for (;(k = s.indexOf('_', j)) >= 0 && k < last; j = k + 1) {
                                      char cc = s.charAt(k + 1);
                                      if (cc < 'a' || cc > 'z') continue; //not found
                          Severity: Minor
                          Found in zcommon/src/main/java/org/zkoss/util/Locales.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

                          Method defaultResolveEntity has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected InputSource defaultResolveEntity(String publicId, String systemId)
                              throws SAXException {
                                  if (systemId == null)
                                      return null;
                          
                          
                          Severity: Minor
                          Found in zcommon/src/main/java/org/zkoss/idom/input/SAXHandler.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

                          Severity
                          Category
                          Status
                          Source
                          Language