Showing 7,775 of 7,775 total issues

Function getForSourceFile has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export function getForSourceFile(sourceFilePath: string): TSDocConfigFile {
    const sourceFileFolder = path.dirname(path.resolve(sourceFilePath));
    // First, determine the file to be loaded. If not found, the configFilePath will be an empty string.
    const configFilePath = TSDocConfigFile.findConfigPathForFolder(sourceFileFolder);
    // If configFilePath is an empty string, then we'll use the folder of sourceFilePath as our cache key.
Severity: Minor
Found in eslint-plugin-zk/src/rules/tsdocConfigCache.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

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

    private TreeitemRenderer<TreeNode<String>> getTreeItemRenderer() {
        return new TreeitemRenderer<TreeNode<String>>() {
            public void render(Treeitem item, TreeNode<String> data, int index) throws Exception {
                Treerow treerow = item.getTreerow();
                if(treerow == null) {
zktest/src/main/java/org/zkoss/zktest/test2/B70_ZK_2764_1.java on lines 115..130
zktest/src/main/java/org/zkoss/zktest/test2/B70_ZK_2764_2.java on lines 133..148
zktest/src/main/java/org/zkoss/zktest/test2/B70_ZK_2764_3.java on lines 178..193

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

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 4 locations. Consider refactoring.
Open

    private TreeitemRenderer<TreeNode<String>> getTreeItemRenderer() {
        return new TreeitemRenderer<TreeNode<String>>() {
            public void render(Treeitem item, TreeNode<String> data, int index) throws Exception {
                Treerow treerow = item.getTreerow();
                if(treerow == null) {
zktest/src/main/java/org/zkoss/zktest/test2/B70_ZK_2764.java on lines 115..130
zktest/src/main/java/org/zkoss/zktest/test2/B70_ZK_2764_1.java on lines 115..130
zktest/src/main/java/org/zkoss/zktest/test2/B70_ZK_2764_3.java on lines 178..193

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

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 4 locations. Consider refactoring.
Open

    private TreeitemRenderer<TreeNode<String>> getTreeItemRenderer() {
        return new TreeitemRenderer<TreeNode<String>>() {
            public void render(Treeitem item, TreeNode<String> data, int index) throws Exception {
                Treerow treerow = item.getTreerow();
                if(treerow == null) {
zktest/src/main/java/org/zkoss/zktest/test2/B70_ZK_2764.java on lines 115..130
zktest/src/main/java/org/zkoss/zktest/test2/B70_ZK_2764_2.java on lines 133..148
zktest/src/main/java/org/zkoss/zktest/test2/B70_ZK_2764_3.java on lines 178..193

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

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

    private static int skipParenthesis(String src, int j, char beg, char end) {
        for (int len = src.length(), depth = 0; ++j < len;) {
            final char cc = src.charAt(j);
            if (cc == '\\') ++j; //skip next
            else if (cc == beg) ++depth;
Severity: Major
Found in zcommon/src/main/java/org/zkoss/lang/Strings.java and 1 other location - About 1 hr to fix
zcommon/src/main/java/org/zkoss/util/Maps.java on lines 619..628

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

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 Validator getValidator() {
        if (_validator == null)
            return null;

        //        final BindContext ctx = BindContextUtil.newBindContext(getBinder(), this, false, null, getComponent(), null);
zkbind/src/main/java/org/zkoss/bind/impl/SavePropertyBindingImpl.java on lines 95..113

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

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 Validator getValidator() {
        if (_validator == null)
            return null;

        //        final BindContext ctx = BindContextUtil.newBindContext(getBinder(), this, false, null, getComponent(), null);
zkbind/src/main/java/org/zkoss/bind/impl/SaveFormBindingImpl.java on lines 96..113

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

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 4 locations. Consider refactoring.
Open

    private TreeitemRenderer<TreeNode<String>> getTreeItemRenderer() {
        return new TreeitemRenderer<TreeNode<String>>() {
            public void render(Treeitem item, TreeNode<String> data, int index) throws Exception {
                Treerow treerow = item.getTreerow();
                if(treerow == null) {
zktest/src/main/java/org/zkoss/zktest/test2/B70_ZK_2764.java on lines 115..130
zktest/src/main/java/org/zkoss/zktest/test2/B70_ZK_2764_1.java on lines 115..130
zktest/src/main/java/org/zkoss/zktest/test2/B70_ZK_2764_2.java on lines 133..148

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

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

    @Listen("onClick = #btnAdd1")
    public void onAdd() {
        Radio radio = new Radio();
        radio.addEventListener("onCheck", new EventListener<Event>() {
            public void onEvent(Event event) throws Exception {
zktest/src/main/java/org/zkoss/zktest/test2/B85_ZK_3818composer_3.java on lines 40..55

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

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

    @Listen("onClick = #btnAdd3")
    public void onAdd() {
        Radio radio = new Radio();
        radio.addEventListener("onCheck", new EventListener<Event>() {
            public void onEvent(Event event) throws Exception {
zktest/src/main/java/org/zkoss/zktest/test2/B85_ZK_3818composer_1.java on lines 37..52

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

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

    private static int skipParenthesis(String src, int j, char beg, char end) {
        for (int len = src.length(), depth = 0; ++j < len;) {
            final char cc = src.charAt(j);
            if (cc == '\\') ++j; //skip next
            else if (cc == beg) ++depth;
Severity: Major
Found in zcommon/src/main/java/org/zkoss/util/Maps.java and 1 other location - About 1 hr to fix
zcommon/src/main/java/org/zkoss/lang/Strings.java on lines 626..635

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

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

    public static final Throwable
    wrap(Throwable ex, Class<? extends Throwable> targetExceptCls, int code, Object[] fmtArgs) {
        ex = myToAnother(ex, targetExceptCls);
        if (targetExceptCls.isInstance(ex))
            return ex;
Severity: Major
Found in zcommon/src/main/java/org/zkoss/lang/Exceptions.java and 1 other location - About 1 hr to fix
zcommon/src/main/java/org/zkoss/lang/Exceptions.java on lines 245..260

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

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

    public static final Throwable
    wrap(Throwable ex, Class<? extends Throwable> targetExceptCls, int code, Object fmtArg) {
        ex = myToAnother(ex, targetExceptCls);
        if (targetExceptCls.isInstance(ex))
            return ex;
Severity: Major
Found in zcommon/src/main/java/org/zkoss/lang/Exceptions.java and 1 other location - About 1 hr to fix
zcommon/src/main/java/org/zkoss/lang/Exceptions.java on lines 222..237

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

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 toStringBuffer has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static final StringBuffer
    toStringBuffer(StringBuffer sb, Map<? super String, ? super String> map, char quote, char separator, char pairSeparator) {
        if (separator == (char)0)
            throw new IllegalArgumentException("Separator cannot be 0");
        if (map.isEmpty())
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/util/Maps.java - About 1 hr to fix

    Method resolveClass has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public java.lang.Class<?> resolveClass(String name) {
            if (name == null || name.contains(".")) {
                return null;
            }
    
    Severity: Minor
    Found in zel/src/main/java/org/zkoss/zel/ImportHandler.java - About 1 hr to fix

      Method jjMoveStringLiteralDfa2_1 has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      private int jjMoveStringLiteralDfa2_1(long old0, long active0)
      {
         if (((active0 &= old0)) == 0L)
            return jjStartNfa_1(0, old0);
         try { curChar = input_stream.readChar(); }

        Method jjMoveStringLiteralDfa2_2 has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        private int jjMoveStringLiteralDfa2_2(long old0, long active0)
        {
           if (((active0 &= old0)) == 0L)
              return jjStartNfa_2(0, old0);
           try { curChar = input_stream.readChar(); }

          Method doSomething has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Listen("onCtrlKey = window#w")
              public void doSomething(KeyEvent evt) {
                  String msg = "";
                  int keyCode = evt.getKeyCode();
                  boolean ctrl = evt.isCtrlKey(),

            Method init has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Init
                public void init() {
                    countries = Arrays.asList(new B70_ZK_2024_ViewModel[] {
                            //
                            new B70_ZK_2024_ViewModel("AT", "\u00D6sterreich"), //

              Method updateCol has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public void updateCol(Event event, int col) {
                      DefaultTreeNode<TestObject> rootNode;
                      String id = (String) event.getData();
                      if (id.startsWith("Row A") || id.startsWith("SubRow A")) {
                          rootNode = (DefaultTreeNode<TestObject>) mymodelA.getRoot();
                Severity
                Category
                Status
                Source
                Language