Showing 7,774 of 7,774 total issues

Similar blocks of code found in 2 locations. 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: Major
Found in zul/src/main/resources/web/js/zul/WScroll.ts and 1 other location - About 2 days to fix
zul/src/main/resources/web/js/zul/WScroll.ts on lines 679..712

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 506.

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

    _mousewheelX(evt: zk.Event, delta: number, deltaX: number, deltaY: number): void {
        if (deltaX) {
            evt.stop();
            var opts = this.opts,
                steps = opts.startStep,
Severity: Major
Found in zul/src/main/resources/web/js/zul/WScroll.ts and 1 other location - About 2 days to fix
zul/src/main/resources/web/js/zul/WScroll.ts on lines 643..676

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 506.

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

BinderImpl has 148 methods (exceeds 20 allowed). Consider refactoring.
Open

public class BinderImpl implements Binder, BinderCtrl, Serializable {
    private static final long serialVersionUID = 1463169907348730644L;

    private static final Logger _log = LoggerFactory.getLogger(BinderImpl.class);

Severity: Major
Found in zkbind/src/main/java/org/zkoss/bind/impl/BinderImpl.java - About 2 days to fix

    Method service has a Cognitive Complexity of 142 (exceeds 5 allowed). Consider refactoring.
    Open

        @SuppressWarnings({ "rawtypes", "unchecked" })
        public void service(org.zkoss.zk.au.AuRequest request, boolean everError) {
            final String cmd = request.getCommand();
            boolean isSelModel = _model instanceof Selectable;
            if (cmd.equals(Events.ON_SELECT)) {
    Severity: Minor
    Found in zul/src/main/java/org/zkoss/zul/Tree.java - About 2 days 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

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

            } else {
                const opts = this.opts,
                    left = opts.startPosition,
                    start = opts.startStep,
                    view = opts.viewport,
    Severity: Major
    Found in zul/src/main/resources/web/js/zul/WScroll.ts and 1 other location - About 2 days to fix
    zul/src/main/resources/web/js/zul/WScroll.ts on lines 335..371

    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 488.

    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

            if (this._isVer) {
                const opts = this.opts,
                    top = opts.startPosition,
                    start = opts.startStep,
                    view = opts.viewport,
    Severity: Major
    Found in zul/src/main/resources/web/js/zul/WScroll.ts and 1 other location - About 2 days to fix
    zul/src/main/resources/web/js/zul/WScroll.ts on lines 371..408

    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 488.

    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 parseItems has a Cognitive Complexity of 139 (exceeds 5 allowed). Consider refactoring.
    Open

        private void parseItems(final PageDefinition pgdef, final NodeInfo parent, Collection items,
                AnnotationHelper annHelper, boolean bNativeContent) throws Exception {
            LanguageDefinition parentlang = getLanguageDefinition(parent);
            if (parentlang == null)
                parentlang = pgdef.getLanguageDefinition();
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 2 days 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

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

                        if (this._isVer) {
                            var end;
                            if (zk(this.eend).isVisible()) {
                                end = this.eend.offsetTop;
                            } else {
    Severity: Major
    Found in zul/src/main/resources/web/js/zul/WScroll.ts and 1 other location - About 2 days to fix
    zul/src/main/resources/web/js/zul/WScroll.ts on lines 569..604

    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 467.

    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

                        if (this._isVer) {
                            var end;
                            if (zk(this.eend).isVisible()) {
                                end = this.eend.offsetTop;
                            } else {
    Severity: Major
    Found in zul/src/main/resources/web/js/zul/WScroll.ts and 1 other location - About 2 days to fix
    zul/src/main/resources/web/js/zul/WScroll.ts on lines 524..559

    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 467.

    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

    DesktopImpl has 137 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class DesktopImpl implements Desktop, DesktopCtrl, java.io.Serializable {
        private static final Logger log = LoggerFactory.getLogger(DesktopImpl.class);
        private static final long serialVersionUID = 20101123L;
    
        /** Represents media stored with {@link #getDownloadMediaURI}.
    Severity: Major
    Found in zk/src/main/java/org/zkoss/zk/ui/impl/DesktopImpl.java - About 2 days to fix

      Method invoke has a Cognitive Complexity of 132 (exceeds 5 allowed). Consider refactoring.
      Open

          public Object invoke(Object self, Method method, Method proceed, Object[] args) throws Exception {
              try {
                  final String mname = method.getName();
                  if (mname.equals("hashCode")) {
                      int a = (_origin != null) ? (Integer) method.invoke(_origin, args) : 0;
      Severity: Minor
      Found in zkbind/src/main/java/org/zkoss/bind/proxy/BeanProxyHandler.java - About 2 days 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 PageImpl.java has 1044 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* PageImpl.java
      
          Purpose:
              
          Description:
      Severity: Major
      Found in zk/src/main/java/org/zkoss/zk/ui/impl/PageImpl.java - About 2 days to fix

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

            private static final byte[] VALCONST = new byte[] {
                0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x41, 0x01, 
                0x41, 0x49, 0x41, 0x59, 0x41, 0x01, 0x41, 0x01, 
                0x41, 0x4f, 0x01, 0x4d, 0x01, 0x4f, 0x01, 0x41, 
                0x01, 0x09, 0x01, 0x0f, 0x01, 0x0f, 0x01, 0x0f, 
        Severity: Major
        Found in zcommon/src/main/java/org/zkoss/idom/Verifier.java and 1 other location - About 2 days to fix
        zcommon/src/main/java/org/zkoss/idom/Verifier.java on lines 177..255

        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 1254.

        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

            private static final int [] LENCONST = new int [] {
                9,     2,     2,     1,    18,     1,     1,     2, 
                9,     2,     1,    10,     1,     2,     1,     1, 
                2,    26,     4,     1,     1,    26,     3,     1, 
               56,     1,     8,    23,     1,    31,     1,    58, 
        Severity: Major
        Found in zcommon/src/main/java/org/zkoss/idom/Verifier.java and 1 other location - About 2 days to fix
        zcommon/src/main/java/org/zkoss/idom/Verifier.java on lines 94..172

        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 1254.

        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 Multiplication has a Cognitive Complexity of 127 (exceeds 5 allowed). Consider refactoring.
        Open

          final public void Multiplication() throws ParseException {
            Unary();
            label_13:
            while (true) {
              switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        Severity: Minor
        Found in zel/src/main/java/org/zkoss/zel/impl/parser/ELParser.java - About 2 days 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 coerce has a Cognitive Complexity of 125 (exceeds 5 allowed). Consider refactoring.
        Open

            public static Object coerce(Class<?> cls, Object val)
            throws ClassCastException {
                if (cls.isInstance(val))
                    return val;
        
        
        Severity: Minor
        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 2 days 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 Classes.java has 1005 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* Classes.java
        
        
            Purpose: Utilities to handle Class
            Description:
        Severity: Major
        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 2 days to fix

          Function create has a Cognitive Complexity of 115 (exceeds 5 allowed). Consider refactoring.
          Open

              create(context) {
                  const tsdocConfig = getTsdocConfig();
                  if (!tsdocConfig) {
                      return {};
                  }
          Severity: Minor
          Found in eslint-plugin-zk/src/rules/tsdocValidation.ts - About 2 days 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 initDataListener has a Cognitive Complexity of 114 (exceeds 5 allowed). Consider refactoring.
          Open

              private void initDataListener() {
                  if (INVALIDATE_THRESHOLD == -1) {
                      INVALIDATE_THRESHOLD = Utils.getIntAttribute(this, "org.zkoss.zul.invalidateThreshold", 10, true);
                  }
                  if (_dataListener == null)
          Severity: Minor
          Found in zul/src/main/java/org/zkoss/zul/Combobox.java - About 2 days 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 _mouseDown has a Cognitive Complexity of 114 (exceeds 5 allowed). Consider refactoring.
          Open

              _mouseDown(evt: zk.Event): void {
                  var cls = evt.target.className,
                      index = cls.lastIndexOf('-'),
                      key = cls.substring(index + 1),
                      $drag = jq(this.edrag);
          Severity: Minor
          Found in zul/src/main/resources/web/js/zul/WScroll.ts - About 2 days 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