zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java

Summary

Maintainability
F
3 days
Test Coverage

ComponentInfo has 48 methods (exceeds 20 allowed). Consider refactoring.
Open

public class ComponentInfo extends ForEachBranchInfo {
    private transient ComponentDefinition _compdef;
    /** The implementation class/component (use). */
    private ExValue _impl;
    /** A list of {@link Property}, or null if no property at all. */
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java - About 6 hrs to fix

    File ComponentInfo.java has 397 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* ComponentInfo.java
    
        Purpose:
            
        Description:
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java - About 5 hrs to fix

      Method evalProperties has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public Map<String, Object> evalProperties(Map<String, Object> propmap, Page owner, Component parent,
                  boolean defIncluded) {
              if (defIncluded)
                  propmap = _compdef.evalProperties(propmap, owner, parent);
              else if (propmap == null)
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method toComposer has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          private static void toComposer(List<Composer> composers, Page page, Object o) throws Exception {
              if (o instanceof String) {
                  final String s = (String) o;
                  if (s.indexOf(',') >= 0)
                      o = CollectionsX.parse(null, s, ','); //No EL
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method applyProperties has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public void applyProperties(Component comp) {
              _compdef.applyProperties(comp);
      
              if (_evthds != null)
                  ((ComponentCtrl) comp).addSharedEventHandlerMap(_evthds);
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.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 evalImpl has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          private Object evalImpl(Page page, Component parent) {
              return _impl == null ? null
                      : parent != null ? _impl.getValue(getEvaluator(), parent)
                              : page != null ? _impl.getValue(getEvaluator(), page)
                                      : _impl.isExpression() ? null : _impl.getRawValue();
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.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 readObject has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
              s.defaultReadObject();
      
              final Object v = s.readObject();
              if (v instanceof String) {
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.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 newInstance has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public Component newInstance(Page page, Component parent) {
              Object impl = evalImpl(page, parent);
              ComponentsCtrl.setCurrentInfo(this);
              final Component comp;
              try {
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java - About 55 mins 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 writeObject has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          private synchronized void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
              s.defaultWriteObject();
      
              final LanguageDefinition langdef = _compdef.getLanguageDefinition();
              if (langdef != null) {
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java - About 45 mins 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 toComposers has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          private static void toComposers(List<Composer> composers, ExValue[] apply, Evaluator eval, Page page,
                  Component comp) throws Exception {
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java - About 35 mins to fix

        Method dupProps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private void dupProps(ComponentInfo compInfo) {
                if (compInfo._annots != null)
                    _annots = (AnnotationMap) compInfo._annots.clone();
                if (compInfo._props != null)
                    _props = new LinkedList<Property>(compInfo._props);
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java - About 25 mins 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

            public String getApply() {
                if (_apply == null)
                    return null;
        
                final StringBuffer sb = new StringBuffer();
        zk/src/main/java/org/zkoss/zk/ui/metainfo/impl/ComponentDefinitionImpl.java on lines 385..396

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

        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 (_props != null) {
                    for (Property prop : _props) {
                        if (parent != null) {
                            if (prop.isEffective(parent))
                                propmap.put(prop.getName(), prop.getValue(parent));
        zk/src/main/java/org/zkoss/zk/ui/metainfo/impl/ComponentDefinitionImpl.java on lines 448..458

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

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

            public void addProperty(String name, NativeInfo value, ConditionImpl cond) {
                if (name == null || name.length() == 0)
                    throw new IllegalArgumentException("name cannot be empty");
        
                if (_props == null)
        Severity: Major
        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java and 2 other locations - About 50 mins to fix
        zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java on lines 467..474
        zk/src/main/java/org/zkoss/zk/ui/metainfo/ShadowInfo.java on lines 176..183

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

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

            public void addProperty(String name, String value, ConditionImpl cond) {
                if (name == null || name.length() == 0)
                    throw new IllegalArgumentException("name cannot be empty");
        
                if (_props == null)
        Severity: Major
        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java and 2 other locations - About 50 mins to fix
        zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java on lines 482..489
        zk/src/main/java/org/zkoss/zk/ui/metainfo/ShadowInfo.java on lines 176..183

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

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

            public void addWidgetListener(String name, String script, ConditionImpl cond) {
                final WidgetListener listener = new WidgetListener(_evalr, name, script, cond);
                if (_wgtlsns == null)
                    _wgtlsns = new LinkedList<WidgetListener>();
                _wgtlsns.add(listener);
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java and 2 other locations - About 35 mins to fix
        zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java on lines 542..547
        zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java on lines 559..564

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

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

            public void addWidgetOverride(String name, String script, ConditionImpl cond) {
                final WidgetOverride mtd = new WidgetOverride(_evalr, name, script, cond);
                if (_wgtovds == null)
                    _wgtovds = new LinkedList<WidgetOverride>();
                _wgtovds.add(mtd);
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java and 2 other locations - About 35 mins to fix
        zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java on lines 525..530
        zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java on lines 559..564

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

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

            public void addWidgetAttribute(String name, String value, ConditionImpl cond) {
                final WidgetAttribute attr = new WidgetAttribute(_evalr, name, value, cond);
                if (_wgtattrs == null)
                    _wgtattrs = new LinkedList<WidgetAttribute>();
                _wgtattrs.add(attr);
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java and 2 other locations - About 35 mins to fix
        zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java on lines 525..530
        zk/src/main/java/org/zkoss/zk/ui/metainfo/ComponentInfo.java on lines 542..547

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

        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

        There are no issues that match your filters.

        Category
        Status