zul/src/main/java/org/zkoss/zul/Messagebox.java

Summary

Maintainability
D
2 days
Test Coverage

Messagebox has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

public class Messagebox {
    private static final Logger log = LoggerFactory.getLogger(Messagebox.class);
    private static String _templ = "~./zul/html/messagebox.zul";

    /** A symbol consisting of a question mark in a circle.
Severity: Minor
Found in zul/src/main/java/org/zkoss/zul/Messagebox.java - About 2 hrs to fix

    Method show has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        public static Button show(String message, String title, Button[] buttons, String[] btnLabels, String icon,
                Button focus, EventListener<ClickEvent> listener, Map<String, String> params) {
            final Map<String, Object> arg = new HashMap<String, Object>();
            final Desktop desktop = Executions.getCurrent().getDesktop();
            arg.put("message", message);
    Severity: Minor
    Found in zul/src/main/java/org/zkoss/zul/Messagebox.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 show has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static Button show(String message, String title, Button[] buttons, String[] btnLabels, String icon,
                Button focus, EventListener<ClickEvent> listener, Map<String, String> params) {
            final Map<String, Object> arg = new HashMap<String, Object>();
            final Desktop desktop = Executions.getCurrent().getDesktop();
            arg.put("message", message);
    Severity: Minor
    Found in zul/src/main/java/org/zkoss/zul/Messagebox.java - About 1 hr to fix

      Method show has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static Button show(String message, String title, Button[] buttons, String[] btnLabels, String icon,
                  Button focus, EventListener<ClickEvent> listener, Map<String, String> params) {
      Severity: Major
      Found in zul/src/main/java/org/zkoss/zul/Messagebox.java - About 1 hr to fix

        Method show has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public static Button show(String message, String title, Button[] buttons, String[] btnLabels, String icon,
                    Button focus, EventListener<ClickEvent> listener) {
        Severity: Major
        Found in zul/src/main/java/org/zkoss/zul/Messagebox.java - About 50 mins to fix

          Method show has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public static int show(int messageCode, Object[] args, int titleCode, int buttons, String icon, int focus,
                      EventListener<Event> listener) {
          Severity: Major
          Found in zul/src/main/java/org/zkoss/zul/Messagebox.java - About 50 mins to fix

            Method show has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public static int show(int messageCode, Object arg, int titleCode, int buttons, String icon, int focus,
                        EventListener<Event> listener) {
            Severity: Major
            Found in zul/src/main/java/org/zkoss/zul/Messagebox.java - About 50 mins to fix

              Method show has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public static Button show(String message, String title, Button[] buttons, String icon, Button focus,
                          EventListener<ClickEvent> listener) {
              Severity: Minor
              Found in zul/src/main/java/org/zkoss/zul/Messagebox.java - About 45 mins to fix

                Method show has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public static int show(int messageCode, Object[] args, int titleCode, int buttons, String icon, int focus) {
                Severity: Minor
                Found in zul/src/main/java/org/zkoss/zul/Messagebox.java - About 45 mins to fix

                  Method show has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public static int show(String message, String title, int buttons, String icon, int focus,
                              EventListener<Event> listener) {
                  Severity: Minor
                  Found in zul/src/main/java/org/zkoss/zul/Messagebox.java - About 45 mins to fix

                    Method show has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public static int show(int messageCode, Object arg, int titleCode, int buttons, String icon, int focus) {
                    Severity: Minor
                    Found in zul/src/main/java/org/zkoss/zul/Messagebox.java - About 45 mins to fix

                      Method show has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public static int show(int messageCode, int titleCode, int buttons, String icon, int focus,
                                  EventListener<Event> listener) {
                      Severity: Minor
                      Found in zul/src/main/java/org/zkoss/zul/Messagebox.java - About 45 mins to fix

                        Method show has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public static Button show(String message, String title, Button[] buttons, String icon,
                                    EventListener<ClickEvent> listener) {
                        Severity: Minor
                        Found in zul/src/main/java/org/zkoss/zul/Messagebox.java - About 35 mins to fix

                          Method show has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public static int show(String message, String title, int buttons, String icon, EventListener<Event> listener) {
                          Severity: Minor
                          Found in zul/src/main/java/org/zkoss/zul/Messagebox.java - About 35 mins to fix

                            Method show has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                public static int show(String message, String title, int buttons, String icon, int focus) {
                            Severity: Minor
                            Found in zul/src/main/java/org/zkoss/zul/Messagebox.java - About 35 mins to fix

                              Method show has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  public static int show(int messageCode, Object arg, int titleCode, int buttons, String icon) {
                              Severity: Minor
                              Found in zul/src/main/java/org/zkoss/zul/Messagebox.java - About 35 mins to fix

                                Method show has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    public static int show(int messageCode, Object[] args, int titleCode, int buttons, String icon) {
                                Severity: Minor
                                Found in zul/src/main/java/org/zkoss/zul/Messagebox.java - About 35 mins to fix

                                  Method show has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      public static int show(int messageCode, int titleCode, int buttons, String icon, int focus) {
                                  Severity: Minor
                                  Found in zul/src/main/java/org/zkoss/zul/Messagebox.java - About 35 mins to fix

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

                                        private static Button[] toButtonTypes(int buttons) {
                                            final List<Button> btntypes = new ArrayList<Button>();
                                            if ((buttons & OK) != 0)
                                                btntypes.add(toButtonType(OK));
                                            if ((buttons & CANCEL) != 0)
                                    Severity: Minor
                                    Found in zul/src/main/java/org/zkoss/zul/Messagebox.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

                                                try {
                                                    dlg.doModal();
                                                } catch (Throwable ex) {
                                                    try {
                                                        dlg.detach();
                                    Severity: Minor
                                    Found in zul/src/main/java/org/zkoss/zul/Messagebox.java and 1 other location - About 40 mins to fix
                                    zul/src/main/java/org/zkoss/zul/Fileupload.java on lines 369..378

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

                                    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 int show(int messageCode, Object[] args, int titleCode, int buttons, String icon, int focus,
                                                EventListener<Event> listener) {
                                            return show(Messages.get(messageCode, args), titleCode > 0 ? Messages.get(titleCode) : null, buttons, icon,
                                                    focus, listener);
                                        }
                                    Severity: Minor
                                    Found in zul/src/main/java/org/zkoss/zul/Messagebox.java and 1 other location - About 35 mins to fix
                                    zul/src/main/java/org/zkoss/zul/Messagebox.java on lines 584..588

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 46.

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

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

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

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

                                    Refactorings

                                    Further Reading

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

                                        public static int show(int messageCode, Object arg, int titleCode, int buttons, String icon, int focus,
                                                EventListener<Event> listener) {
                                            return show(Messages.get(messageCode, arg), titleCode > 0 ? Messages.get(titleCode) : null, buttons, icon,
                                                    focus, listener);
                                        }
                                    Severity: Minor
                                    Found in zul/src/main/java/org/zkoss/zul/Messagebox.java and 1 other location - About 35 mins to fix
                                    zul/src/main/java/org/zkoss/zul/Messagebox.java on lines 504..508

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 46.

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

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

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

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

                                    Refactorings

                                    Further Reading

                                    There are no issues that match your filters.

                                    Category
                                    Status