Showing 7,775 of 7,775 total issues

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

    private Book initBook(String name, String author, String categories) {
        Book book = new Book();
        book.setName(name);
        book.setAuthor(author);
        String[] cates = categories.split(",");
zktest/src/main/java/org/zkoss/zktest/bind/viewmodel/form/FormProxyDirtyVM.java on lines 65..78

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

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 onPageDetached(Page page) {
        super.onPageDetached(page);
        if (_model != null && _dataListener != null)
            _model.removeListDataListener(_dataListener);
        if (_model instanceof PageableModel && _pgListener != null)
Severity: Major
Found in zul/src/main/java/org/zkoss/zul/Listbox.java and 1 other location - About 1 hr to fix
zul/src/main/java/org/zkoss/zul/Grid.java on lines 328..337

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

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

    public final static String toString(short[] array) {
        if (array == null)
            return "null";

        StringBuffer sb = new StringBuffer(128).append('[');
Severity: Major
Found in zcommon/src/main/java/org/zkoss/util/ArraysX.java and 7 other locations - About 1 hr to fix
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 50..61
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 64..75
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 92..103
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 106..117
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 120..131
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 134..145
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 148..159

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

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

        public boolean equals(Object obj) {
            if (this == obj)
                return true;
            if (obj == null)
                return false;
zktest/src/main/java/org/zkoss/zktest/bind/issue/B02078.java on lines 163..178
zktest/src/main/java/org/zkoss/zktest/test2/B80_ZK_3010Tag.java on lines 49..64

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

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

    public final static String toString(long[] array) {
        if (array == null)
            return "null";

        StringBuffer sb = new StringBuffer(128).append('[');
Severity: Major
Found in zcommon/src/main/java/org/zkoss/util/ArraysX.java and 7 other locations - About 1 hr to fix
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 50..61
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 78..89
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 92..103
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 106..117
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 120..131
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 134..145
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 148..159

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

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

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
zktest/src/main/java/org/zkoss/zktest/bind/issue/B01899ComboboxReloadSelectedItem.java on lines 82..96
zktest/src/main/java/org/zkoss/zktest/bind/issue/B02078.java on lines 163..178

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

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

    public final static String toString(char[] array) {
        if (array == null)
            return "null";

        StringBuffer sb = new StringBuffer(128).append('[');
Severity: Major
Found in zcommon/src/main/java/org/zkoss/util/ArraysX.java and 7 other locations - About 1 hr to fix
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 50..61
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 64..75
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 78..89
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 92..103
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 120..131
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 134..145
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 148..159

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

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 Book initBook(String name, String author, String categories) {
        Book book = new Book();
        book.setName(name);
        book.setAuthor(author);
        String[] cates = categories.split(",");
zktest/src/main/java/org/zkoss/zktest/zats/zuti/vm/FormVM.java on lines 50..63

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

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

        @Override
        public boolean equals(Object obj) {
            if (this == obj)
                return true;
            if (obj == null)
zktest/src/main/java/org/zkoss/zktest/bind/issue/B01899ComboboxReloadSelectedItem.java on lines 82..96
zktest/src/main/java/org/zkoss/zktest/test2/B80_ZK_3010Tag.java on lines 49..64

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

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

    public final static String toString(float[] array) {
        if (array == null)
            return "null";

        StringBuffer sb = new StringBuffer(128).append('[');
Severity: Major
Found in zcommon/src/main/java/org/zkoss/util/ArraysX.java and 7 other locations - About 1 hr to fix
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 50..61
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 64..75
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 78..89
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 92..103
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 106..117
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 120..131
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 148..159

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

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

    public final static String toString(byte[] array) {
        if (array == null)
            return "null";

        StringBuffer sb = new StringBuffer(128).append('[');
Severity: Major
Found in zcommon/src/main/java/org/zkoss/util/ArraysX.java and 7 other locations - About 1 hr to fix
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 50..61
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 64..75
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 78..89
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 106..117
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 120..131
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 134..145
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 148..159

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

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

    public final static String toString(double[] array) {
        if (array == null)
            return "null";

        StringBuffer sb = new StringBuffer(128).append('[');
Severity: Major
Found in zcommon/src/main/java/org/zkoss/util/ArraysX.java and 7 other locations - About 1 hr to fix
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 50..61
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 64..75
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 78..89
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 92..103
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 106..117
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 120..131
zcommon/src/main/java/org/zkoss/util/ArraysX.java on lines 134..145

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

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 onPageDetached(Page page) {
        super.onPageDetached(page);
        if (_model != null && _dataListener != null)
            _model.removeListDataListener(_dataListener);
        if (_model instanceof PageableModel && _pgListener != null)
Severity: Major
Found in zul/src/main/java/org/zkoss/zul/Grid.java and 1 other location - About 1 hr to fix
zul/src/main/java/org/zkoss/zul/Listbox.java on lines 3090..3099

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

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

        for (Iterator it = conf.getElements("addon-uri").iterator(); it.hasNext();) {
            final Element el = (Element) it.next();
            final String path = el.getText(true);

            final URL url = locator.getResource(path);
Severity: Major
Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java and 1 other location - About 1 hr to fix
zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java on lines 872..881

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

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

        for (Iterator it = conf.getElements("language-uri").iterator(); it.hasNext();) {
            final Element el = (Element) it.next();
            final String path = el.getText(true);

            final URL url = locator.getResource(path);
Severity: Major
Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java and 1 other location - About 1 hr to fix
zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java on lines 862..871

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

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

    public static String get(int code, Object[] fmtArgs, Locale locale) {
        try {
            String s = getFromBundle(code, locale);
            if (s == null)
                return getNotFound(code, locale);
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/mesg/Messages.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 getPrologHalf has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    /* package */ String getPrologHalf(boolean hideUuidIfNoId) {
        final StringBuilder sb = new StringBuilder(128).append('<').append(_tagnm);

//        Do this at client side for ZK-5270
//        if ((!hideUuidIfNoId && !shallHideId()) || getId().length() > 0)
Severity: Minor
Found in zhtml/src/main/java/org/zkoss/zhtml/impl/AbstractTag.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 run has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public final void run(IN input) {
        
        C inputClass = getClass(input);
        
        doDebug("");
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/fsm/StateMachine.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 encodeAttribute has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static final String encodeAttribute(String value) {
        StringBuffer sb = null;
        for (int j = 0, len = value.length(); j < len; ++j) {
            final char cc = value.charAt(j);
            final String rep;
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/xml/XMLs.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 encodeText has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static final String encodeText(String value) {
        StringBuffer sb = null;
        for (int j = 0, len = value.length(); j < len; ++j) {
            final char cc = value.charAt(j);
            final String rep;
Severity: Minor
Found in zcommon/src/main/java/org/zkoss/xml/XMLs.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