zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java

Summary

Maintainability
F
1 wk
Test Coverage

File ConfigParser.java has 675 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* ConfigParser.java

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

    Method parse has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
    Open

        public void parse(Element root, Configuration config, Locator locator) throws Exception {
            l_out: for (Iterator it = root.getElements().iterator(); it.hasNext();) {
                final Element el = (Element) it.next();
                final String elnm = el.getName();
                // B65-ZK-1671: ThemeProvider specified in metainfo/zk/zk.xml may get overridden by default
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java - About 1 day 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 parseDesktopConfig has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        private static void parseDesktopConfig(Configuration config, Element conf) throws Exception {
            //theme-uri
            for (Iterator<Element> it = conf.getElements("theme-uri").iterator(); it.hasNext();) {
                final Element el = (Element) it.next();
                final String uri = el.getText(true);
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.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 parseClientConfig has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        private static void parseClientConfig(Configuration config, Element conf) {
            Integer v = parseInteger(conf, "processing-prompt-delay", POSITIVE_ONLY);
            if (v != null)
                config.setProcessingPromptDelay(v.intValue());
    
    
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.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 parseSystemConfig has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

        @SuppressWarnings("deprecation")
        private static void parseSystemConfig(Configuration config, Element el) throws Exception {
            String s = el.getElementValue("disable-event-thread", true);
            if (s != null) {
                final boolean enable = "false".equals(s);
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java - About 4 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 parseConfigXml has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        public void parseConfigXml(Configuration config) {
            boolean syscfgLoaded;
            boolean syscfgLoadedConfig;
            synchronized (ConfigParser.class) {
                syscfgLoaded = _syscfgLoaded;
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java - About 4 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 parse has 86 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public void parse(Element root, Configuration config, Locator locator) throws Exception {
            l_out: for (Iterator it = root.getElements().iterator(); it.hasNext();) {
                final Element el = (Element) it.next();
                final String elnm = el.getName();
                // B65-ZK-1671: ThemeProvider specified in metainfo/zk/zk.xml may get overridden by default
    Severity: Major
    Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java - About 3 hrs to fix

      Method parseSystemConfig has 85 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @SuppressWarnings("deprecation")
          private static void parseSystemConfig(Configuration config, Element el) throws Exception {
              String s = el.getElementValue("disable-event-thread", true);
              if (s != null) {
                  final boolean enable = "false".equals(s);
      Severity: Major
      Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java - About 3 hrs to fix

        ConfigParser has 28 methods (exceeds 20 allowed). Consider refactoring.
        Open

        public class ConfigParser {
            private static final Logger log = LoggerFactory.getLogger(ConfigParser.class);
        
            /** The number of segments in a version.
             */
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java - About 3 hrs to fix

          Method parseClientConfig has 78 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static void parseClientConfig(Configuration config, Element conf) {
                  Integer v = parseInteger(conf, "processing-prompt-delay", POSITIVE_ONLY);
                  if (v != null)
                      config.setProcessingPromptDelay(v.intValue());
          
          
          Severity: Major
          Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java - About 3 hrs to fix

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

                public static void parseLibProperty(Element el) {
                    final String nm = IDOMs.getRequiredElementValue(el, "name");
                    Element valueElmn = el.getElement("value");
                    Element appendableElmn = el.getElement("appendable");
                    boolean appendable = appendableElmn != null ? "true".equals(appendableElmn.getText(true)) : false;
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.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 parseDesktopConfig has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static void parseDesktopConfig(Configuration config, Element conf) throws Exception {
                    //theme-uri
                    for (Iterator<Element> it = conf.getElements("theme-uri").iterator(); it.hasNext();) {
                        final Element el = (Element) it.next();
                        final String uri = el.getText(true);
            Severity: Major
            Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java - About 2 hrs to fix

              Method parseClass has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static <T> Class<T> parseClass(Element el, String elnm, Class<?> cls, boolean required) {
                      //Note: we throw exception rather than warning to make sure
                      //the developer correct it
                      final String clsnm = el.getElementValue(elnm, true);
                      if (clsnm != null && clsnm.length() != 0) {
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.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 parseConfigXml has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public void parseConfigXml(Configuration config) {
                      boolean syscfgLoaded;
                      boolean syscfgLoadedConfig;
                      synchronized (ConfigParser.class) {
                          syscfgLoaded = _syscfgLoaded;
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java - About 1 hr to fix

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

                    private static void parseSubSystemConfig(Configuration config, Element root) throws Exception {
                        for (Element el : root.getElements("system-config")) {
                            if (config != null) {
                                parseSystemConfig(config, el);
                            } else {
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.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 checkVersion has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static boolean checkVersion(URL url, Document doc, boolean zk5required) throws Exception {
                        final Element el = doc.getRootElement().getElement("version");
                        if (el == null)
                            return true; //version is optional (3.0.5)
                
                
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java - About 1 hr to fix

                  Method checkVersion has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static boolean checkVersion(URL url, Document doc, boolean zk5required) throws Exception {
                          final Element el = doc.getRootElement().getElement("version");
                          if (el == null)
                              return true; //version is optional (3.0.5)
                  
                  
                  Severity: Minor
                  Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.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 parseLibProperty has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static void parseLibProperty(Element el) {
                          final String nm = IDOMs.getRequiredElementValue(el, "name");
                          Element valueElmn = el.getElement("value");
                          Element appendableElmn = el.getElement("appendable");
                          boolean appendable = appendableElmn != null ? "true".equals(appendableElmn.getText(true)) : false;
                  Severity: Minor
                  Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java - About 1 hr to fix

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

                        private static Integer parseInteger(Element el, String subnm, int flag) throws UiException {
                            //Note: we throw exception rather than warning to make sure
                            //the developer correct it
                            String val = el.getElementValue(subnm, true);
                            if (val != null && val.length() > 0) {
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.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

                    Avoid too many return statements within this method.
                    Open

                            return true; //matched
                    Severity: Major
                    Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return false;
                      Severity: Major
                      Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java - About 30 mins to fix

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

                            private static void parseLangConfig(Locator locator, Element conf) {
                                for (Iterator it = conf.getElements("addon-uri").iterator(); it.hasNext();) {
                                    final Element el = (Element) it.next();
                                    final String path = el.getText(true);
                        
                        
                        Severity: Minor
                        Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.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

                                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

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

                                if (!config.isCustomThemeResolver()) {
                                    cls = parseClass(conf, "theme-resolver-class", ThemeResolver.class);
                                    if (cls != null) {
                                        if (!cls.getName().startsWith("org.zkoss."))
                                            config.setCustomThemeResolver(true);
                        Severity: Major
                        Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java and 2 other locations - About 1 hr to fix
                        zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java on lines 563..572
                        zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java on lines 576..585

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

                        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

                                if (!config.isCustomThemeProvider()) {
                                    cls = parseClass(conf, "theme-provider-class", ThemeProvider.class);
                                    if (cls != null) {
                                        if (!cls.getName().startsWith("org.zkoss."))
                                            config.setCustomThemeProvider(true);
                        Severity: Major
                        Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java and 2 other locations - About 1 hr to fix
                        zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java on lines 576..585
                        zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java on lines 589..598

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

                        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

                                if (!config.isCustomThemeRegistry()) {
                                    cls = parseClass(conf, "theme-registry-class", ThemeRegistry.class);
                                    if (cls != null) {
                                        if (!cls.getName().startsWith("org.zkoss."))
                                            config.setCustomThemeRegistry(true);
                        Severity: Major
                        Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java and 2 other locations - About 1 hr to fix
                        zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java on lines 563..572
                        zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java on lines 589..598

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

                        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<Element> it = conf.getElements("disable-theme-uri").iterator(); it.hasNext();) {
                                    final Element el = (Element) it.next();
                                    final String uri = el.getText(true);
                                    if (uri.length() != 0)
                                        config.addDisabledThemeURI(uri);
                        Severity: Minor
                        Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java and 1 other location - About 50 mins to fix
                        zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java on lines 545..550

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

                                for (Iterator<Element> it = conf.getElements("theme-uri").iterator(); it.hasNext();) {
                                    final Element el = (Element) it.next();
                                    final String uri = el.getText(true);
                                    if (uri.length() != 0)
                                        config.addThemeURI(uri);
                        Severity: Minor
                        Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java and 1 other location - About 50 mins to fix
                        zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java on lines 553..558

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

                            private static void parseSubZScriptConfig(Element root) {
                                for (Iterator it = root.getElements("zscript-config").iterator(); it.hasNext();) {
                                    final Element el = (Element) it.next();
                                    Interpreters.add(el);
                                    //Note: zscript-config is applied to the whole system, not just langdef
                        Severity: Minor
                        Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java and 1 other location - About 35 mins to fix
                        zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java on lines 221..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 44.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

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

                            private static void parseSubDeviceConfig(Element root) {
                                for (Iterator it = root.getElements("device-config").iterator(); it.hasNext();) {
                                    final Element el = (Element) it.next();
                                    Devices.add(el);
                                }
                        Severity: Minor
                        Found in zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java and 1 other location - About 35 mins to fix
                        zk/src/main/java/org/zkoss/zk/ui/sys/ConfigParser.java on lines 213..219

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

                        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