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

Summary

Maintainability
F
1 wk
Test Coverage

File HtmlPageRenders.java has 845 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* HtmlPageRenders.java

    Purpose:
        
    Description:
Severity: Major
Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java - About 2 days to fix

    Method outLangJavaScripts has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
    Open

        public static final String outLangJavaScripts(Execution exec, WebApp wapp, String deviceType) {
            if (exec.isAsyncUpdate(null) || exec.getAttribute(ATTR_LANG_JS_GENED) != null)
                return ""; //nothing to generate
            exec.setAttribute(ATTR_LANG_JS_GENED, Boolean.TRUE);
    
    
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.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 outPageContent has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

        public static final void outPageContent(Execution exec, Page page, Writer out, boolean au) throws IOException {
            final Desktop desktop = page.getDesktop();
            final PageCtrl pageCtrl = (PageCtrl) page;
            final Component owner = pageCtrl.getOwner();
            boolean contained = owner == null && exec.isIncluded();
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java - About 7 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 outPageContent has 129 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static final void outPageContent(Execution exec, Page page, Writer out, boolean au) throws IOException {
            final Desktop desktop = page.getDesktop();
            final PageCtrl pageCtrl = (PageCtrl) page;
            final Component owner = pageCtrl.getOwner();
            boolean contained = owner == null && exec.isIncluded();
    Severity: Major
    Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java - About 5 hrs to fix

      HtmlPageRenders has 35 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public class HtmlPageRenders {
          //    private static final Logger log = LoggerFactory.getLogger(HtmlPageRenders.class);
      
          /** Denotes whether style sheets are generated for this request. */
          private static final String ATTR_LANG_CSS_GENED = "javax.zkoss.zk.lang.css.generated";
      Severity: Minor
      Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java - About 4 hrs to fix

        Method getStyleSheets has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            public static final List<StyleSheet> getStyleSheets(Execution exec, WebApp wapp, String deviceType) {
                if (wapp == null)
                    wapp = exec.getDesktop().getWebApp();
                if (deviceType == null)
                    deviceType = exec.getDesktop().getDeviceType();
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java - About 3 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 outLangJavaScripts has 96 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static final String outLangJavaScripts(Execution exec, WebApp wapp, String deviceType) {
                if (exec.isAsyncUpdate(null) || exec.getAttribute(ATTR_LANG_JS_GENED) != null)
                    return ""; //nothing to generate
                exec.setAttribute(ATTR_LANG_JS_GENED, Boolean.TRUE);
        
        
        Severity: Major
        Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java - About 3 hrs to fix

          Method append has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              private static void append(StringBuffer sb, StyleSheet ss, Execution exec, Page page) {
                  String href = ss.getHref();
                  String media = ss.getMedia();
                  if (href != null) {
                      try {
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java - About 3 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 outEndJavaScriptFunc has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              private static void outEndJavaScriptFunc(Execution exec, Writer out, String extra, boolean aupg, boolean afterLoad)
                      throws IOException {
                  final String ac = outResponseJavaScripts(exec, true);
                  if (aupg) {
                      if (extra.length() > 0 || ac.length() > 0) {
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.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 outHeaderZkTags has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              public static String outHeaderZkTags(Execution exec, Page page) {
                  String s1 = outHeaders(exec, page, true), s2 = outZkTags(exec, null, null), s3 = outHeaders(exec, page, false);
                  return s1 != null ? s2 != null ? s3 != null ? s1 + s2 + s3 : s1 + s2 : s3 != null ? s1 + s3 : s1
                          : //s2 null
                          s2 != null ? s3 != null ? s2 + s3 : s2 : s3 != null ? s3 : null; //s2 null
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.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 outZkTags has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              public static String outZkTags(Execution exec, WebApp wapp, String deviceType) {
                  if (exec.getAttribute(ATTR_ZK_TAGS_GENERATED) != null)
                      return null;
                  exec.setAttribute(ATTR_ZK_TAGS_GENERATED, Boolean.TRUE);
          
          
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.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 outLangStyleSheets has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              public static final String outLangStyleSheets(Execution exec, WebApp wapp, String deviceType) {
                  if (exec.isAsyncUpdate(null) || exec.getAttribute(ATTR_LANG_CSS_GENED) != null)
                      return ""; //nothing to generate
                  exec.setAttribute(ATTR_LANG_CSS_GENED, Boolean.TRUE);
          
          
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.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 getStyleSheets has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static final List<StyleSheet> getStyleSheets(Execution exec, WebApp wapp, String deviceType) {
                  if (wapp == null)
                      wapp = exec.getDesktop().getWebApp();
                  if (deviceType == null)
                      deviceType = exec.getDesktop().getDeviceType();
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java - About 1 hr to fix

            Method outSpecialJS has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                public static final String outSpecialJS(Desktop desktop) {
                    final StringBuffer sb = new StringBuffer();
            
                    //output application name
                    String oldnm = (String) desktop.getAttribute(ATTR_APPNM);
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.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 append has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                private static void append(StringBuffer sb, JavaScript js) {
                    sb.append("\n<script type=\"text/javascript\"");
                    if (js.getSrc() != null) {
                        String url;
                        try {
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.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 outStandalone has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static final void outStandalone(Execution exec, Component comp, Writer out) throws IOException {
                    if (ComponentRedraws.beforeRedraw(false) >= 0)
                        throw new InternalError("Not possible: " + comp);
            
                    final String extra;
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java - About 1 hr to fix

              Method outEndJavaScriptFunc has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static void outEndJavaScriptFunc(Execution exec, Writer out, String extra, boolean aupg, boolean afterLoad)
                          throws IOException {
                      final String ac = outResponseJavaScripts(exec, true);
                      if (aupg) {
                          if (extra.length() > 0 || ac.length() > 0) {
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java - About 1 hr to fix

                Method outZkTags has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static String outZkTags(Execution exec, WebApp wapp, String deviceType) {
                        if (exec.getAttribute(ATTR_ZK_TAGS_GENERATED) != null)
                            return null;
                        exec.setAttribute(ATTR_ZK_TAGS_GENERATED, Boolean.TRUE);
                
                
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java - About 1 hr to fix

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

                      private static void outDivTemplateEnd(Page page, Writer out) throws IOException {
                          final Desktop dt;
                          if (page != null && (dt = page.getDesktop()) != null) {
                              if (dt.getAttribute(ATTR_DESKTOP_CLIENTINFO) != null) {
                                  dt.removeAttribute(ATTR_DESKTOP_CLIENTINFO);
                  Severity: Minor
                  Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.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 outSpecialJS has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static final String outSpecialJS(Desktop desktop) {
                          final StringBuffer sb = new StringBuffer();
                  
                          //output application name
                          String oldnm = (String) desktop.getAttribute(ATTR_APPNM);
                  Severity: Minor
                  Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java - About 1 hr to fix

                    Method outLangStyleSheets has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static final String outLangStyleSheets(Execution exec, WebApp wapp, String deviceType) {
                            if (exec.isAsyncUpdate(null) || exec.getAttribute(ATTR_LANG_CSS_GENED) != null)
                                return ""; //nothing to generate
                            exec.setAttribute(ATTR_LANG_CSS_GENED, Boolean.TRUE);
                    
                    
                    Severity: Minor
                    Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java - About 1 hr to fix

                      Method outStandalone has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static final void outStandalone(Execution exec, Component comp, Writer out) throws IOException {
                              if (ComponentRedraws.beforeRedraw(false) >= 0)
                                  throw new InternalError("Not possible: " + comp);
                      
                              final String extra;
                      Severity: Minor
                      Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.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 isGroupingAllowed has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private static final boolean isGroupingAllowed(Desktop desktop) {
                              final String name = "org.zkoss.zk.ui.input.grouping.allowed";
                              if (desktop != null) {
                                  final Collection<Page> pages = desktop.getPages();
                                  if (!pages.isEmpty()) {
                      Severity: Minor
                      Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.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 outResponseJavaScripts has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static final String outResponseJavaScripts(Execution exec, boolean directJS) {
                              final ExecutionCtrl execCtrl = (ExecutionCtrl) exec;
                              final Collection<AuResponse> responses = execCtrl.getResponses();
                              if (responses == null || responses.isEmpty())
                                  return "";
                      Severity: Minor
                      Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.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 setContentType has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static final void setContentType(Execution exec, Page page) {
                              String contentType = ((PageCtrl) page).getContentType();
                              if (contentType == null) {
                                  contentType = page.getDesktop().getDevice().getContentType();
                                  if (contentType == null)
                      Severity: Minor
                      Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.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 outInitCrashScript has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static final String outInitCrashScript(Execution exec, WebApp wapp) {
                              if (exec.isAsyncUpdate(null))
                                  return ""; //nothing to generate
                      
                              if (wapp == null)
                      Severity: Minor
                      Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.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 outEndJavaScriptFunc has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          private static void outEndJavaScriptFunc(Execution exec, Writer out, String extra, boolean aupg, boolean afterLoad)
                      Severity: Minor
                      Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java - About 35 mins to fix

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

                            private static Boolean getAutomaticTimeout(Desktop desktop) {
                                if (desktop != null)
                                    for (Page page : desktop.getPages()) {
                                        Boolean b = ((PageCtrl) page).getAutomaticTimeout();
                                        if (b != null)
                        Severity: Minor
                        Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.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

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

                            private static String getContextURI(Execution exec) {
                                if (exec != null) {
                                    String s = exec.getContextURI();
                                    int j = s.lastIndexOf('/'); //might have jsessionid=...
                                    return j >= 0 ? s.substring(0, j) + s.substring(j + 1) : s;
                        Severity: Minor
                        Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java and 1 other location - About 1 hr to fix
                        zkplus/src/main/java/org/zkoss/zkplus/embed/Renders.java on lines 225..232

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

                        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 (extra.length() > 0) {
                                            out.write(",'");
                                            out.write(Strings.escape(extra, Strings.ESCAPE_JAVASCRIPT));
                                            out.write('\'');
                                        }
                        Severity: Minor
                        Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java and 1 other location - About 35 mins to fix
                        zk/src/main/java/org/zkoss/zk/ui/AbstractComponent.java on lines 2233..2237

                        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

                            public static final RenderContext getRenderContext(Execution exec) {
                                if (exec == null)
                                    exec = Executions.getCurrent();
                                return exec != null ? (RenderContext) exec.getAttribute(ATTR_RENDER_CONTEXT) : null;
                            }
                        Severity: Minor
                        Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java and 1 other location - About 30 mins to fix
                        zhtml/src/main/java/org/zkoss/zhtml/impl/PageRenderer.java on lines 54..58

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

                        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