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

Summary

Maintainability
F
1 wk
Test Coverage

Method parseLang has a Cognitive Complexity of 223 (exceeds 5 allowed). Consider refactoring.
Open

    private static void parseLang(Document doc, Locator locator, URL url, boolean addon) throws Exception {
        final Element root = doc.getRootElement();
        final String lang = IDOMs.getRequiredElementValue(root, "language-name");
        final LanguageDefinition langdef;
        final Device device;
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java - About 4 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 parseLang has 321 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static void parseLang(Document doc, Locator locator, URL url, boolean addon) throws Exception {
        final Element root = doc.getRootElement();
        final String lang = IDOMs.getRequiredElementValue(root, "language-name");
        final LanguageDefinition langdef;
        final Device device;
Severity: Major
Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java - About 1 day to fix

    File DefinitionLoaders.java has 688 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* DefinitionLoaders.java
    
        Purpose:
            
        Description:
    Severity: Major
    Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java - About 1 day to fix

      Method load0 has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

          private static void load0() throws java.io.IOException {
              final XMLResourcesLocator locator = Utils.getXMLResourcesLocator();
      
              //1. parse config.xml
              final ConfigParser parser = new ConfigParser();
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java - About 5 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 load0 has 81 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private static void load0() throws java.io.IOException {
              final XMLResourcesLocator locator = Utils.getXMLResourcesLocator();
      
              //1. parse config.xml
              final ConfigParser parser = new ConfigParser();
      Severity: Major
      Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java - About 3 hrs to fix

        DefinitionLoaders has 27 methods (exceeds 20 allowed). Consider refactoring.
        Open

        public class DefinitionLoaders {
            private static final Logger log = LoggerFactory.getLogger(DefinitionLoaders.class);
        
            /** List<Object[Locator, URL]> */
            private static List<Object[]> _addons;
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java - About 3 hrs to fix

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

              private static void parsePI(LanguageDefinition langdef, Document doc) throws Exception {
                  for (Iterator it = doc.getChildren().iterator(); it.hasNext();) {
                      final Object o = it.next();
                      if (!(o instanceof ProcessingInstruction))
                          continue;
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.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 parseExtensions has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              private static List<String> parseExtensions(Element elm) {
                  final List<String> exts = new LinkedList<String>();
                  for (Element el : elm.getElements("extension")) {
                      final String ext = el.getText(true);
                      if (ext.length() != 0) {
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.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

          Avoid deeply nested control flow statements.
          Open

                                  if (n != null && !withEL(n)) {
                                      int k = n.lastIndexOf('.');
                                      cssURI = "~." + device.toAbsolutePath(n.substring(0, k).replace('.', '/') + '/' + cssURI);
                                  } else {
                                      if (n == null) {
          Severity: Major
          Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java - About 45 mins to fix

            Method addExtension has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public static final void addExtension(String ext, String lang) {
                    if (_loaded) {
                        LanguageDefinition.addExtension(ext, lang);
                    } else {
                        if (lang == null || ext == null)
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.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

            Consider simplifying this complex logical expression.
            Open

                                if ((cc < 'a' || cc > 'z') && (cc < 'A' || cc > 'Z') && (cc < '0' || cc > '9'))
                                    throw new UiException(
                                            message("Invalid extension; only letters and numbers are allowed: " + ext, elm));
            Severity: Major
            Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java - About 40 mins to fix

              Method parseInteger has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static Integer parseInteger(Element el, String subnm, boolean positiveOnly) throws UiException {
                      //Warning instead of exception since config.xml is embedded in jar, so
                      //better not to stop the process
                      String val = el.getElementValue(subnm, true);
                      if (val != null && val.length() > 0) {
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java - About 35 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 parseTextAs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static void parseTextAs(ComponentDefinitionImpl compdef, Element el) {
                      if (el != null) {
                          final String s = el.getText(true);
                          noEmpty("text-as", s, el);
                          noEL("text-as", s, el);
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java - About 35 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 addAddon has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static void addAddon(Locator locator, URL url) {
                      if (locator == null || url == null)
                          throw new IllegalArgumentException("null");
              
                      if (_loaded) {
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.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

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

                  public static void addLanguage(Locator locator, URL url) {
                      if (locator == null || url == null)
                          throw new IllegalArgumentException("null");
              
                      if (_loaded) {
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.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

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

                  @SuppressWarnings("unchecked")
                  private static <T> Class<? extends T> locateClass(String clsnm, Class<?>... clses) throws Exception {
                      final Class<?> c = Classes.forNameByThread(clsnm, false); // check only for ZK-5257
                      if (clses != null)
                          for (Class<?> cls : clses)
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.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

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

                  public static void addLanguage(Locator locator, URL url) {
                      if (locator == null || url == null)
                          throw new IllegalArgumentException("null");
              
                      if (_loaded) {
              zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java on lines 103..114

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

              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 void addAddon(Locator locator, URL url) {
                      if (locator == null || url == null)
                          throw new IllegalArgumentException("null");
              
                      if (_loaded) {
              zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java on lines 120..131

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

              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 (_addons != null) {
                          for (Iterator<Object[]> it = _addons.iterator(); it.hasNext();) {
                              final Object[] p = it.next();
                              loadLang((Locator) p[0], (URL) p[1], true); //addon
                          }
              zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java on lines 220..226

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

              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

                          try {
                              if (ConfigParser.checkVersion(url, res.document, true))
                                  parseLang(res.document, locator, url, false);
                          } catch (Exception ex) {
                              log.error("Failed to load " + url, ex);
              zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java on lines 257..264

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

              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

                          try {
                              if (ConfigParser.checkVersion(url, res.document, true))
                                  parseLang(res.document, locator, url, false);
                          } catch (Exception ex) {
                              log.error("Failed to load " + url, ex);
              zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java on lines 209..216

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

              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 (_langs != null) {
                          for (Iterator<Object[]> it = _langs.iterator(); it.hasNext();) {
                              final Object[] p = it.next();
                              loadLang((Locator) p[0], (URL) p[1], false);
                          }
              zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java on lines 242..248

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

              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

                  private static void parseMacroTemplate(LanguageDefinition langdef, Element el) throws Exception {
                      el = el.getElement("macro-template");
                      if (el != null) {
                          final Class<? extends Component> cls = locateClass(IDOMs.getRequiredElementValue(el, "macro-class"),
                                  Component.class, Macro.class);
              zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java on lines 787..794
              zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java on lines 797..804

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

              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

                  private static void parseNativeTemplate(LanguageDefinition langdef, Element el) throws Exception {
                      el = el.getElement("native-template");
                      if (el != null) {
                          final Class<? extends Component> cls = locateClass(IDOMs.getRequiredElementValue(el, "native-class"),
                                  Component.class, Native.class);
              zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java on lines 778..785
              zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java on lines 797..804

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

              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

                  private static void parseShadowTemplate(LanguageDefinition langdef, Element el) throws Exception {
                      el = el.getElement("shadow-template");
                      if (el != null) {
                          final Class<? extends Component> cls = locateClass(IDOMs.getRequiredElementValue(el, "shadow-class"),
                                  Component.class, ShadowElement.class);
              zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java on lines 778..785
              zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java on lines 787..794

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

              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

                              } else {
                                  compdef = cls != null ? new ComponentDefinitionImpl(langdef, null, name, cls)
                                          : new ComponentDefinitionImpl(langdef, null, name, clsnm);
                                  compdef.setDeclarationURL(url);
                                  langdef.addComponentDefinition(compdef);
              zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java on lines 590..595

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

              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 (s != null && !"false".equals(s)) {
                                  compdef = cls != null ? new ShadowDefinitionImpl(langdef, null, name, cls)
                                          : new ShadowDefinitionImpl(langdef, null, name, clsnm);
                                  compdef.setDeclarationURL(url);
                                  langdef.addShadowDefinition(compdef);
              zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java on lines 595..600

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

              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 e = parseCustAttrs(el).entrySet().iterator(); e.hasNext();) {
                              final Map.Entry me = (Map.Entry) e.next();
                              compdef.addCustomAttribute((String) me.getKey(), (String) me.getValue());
                          }
              zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java on lines 672..675

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

              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 e = parseProps(el).entrySet().iterator(); e.hasNext();) {
                              final Map.Entry me = (Map.Entry) e.next();
                              compdef.addProperty((String) me.getKey(), (String) me.getValue());
                          }
              zk/src/main/java/org/zkoss/zk/ui/metainfo/DefinitionLoaders.java on lines 667..670

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

              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