zk/src/main/java/org/zkoss/zk/ui/util/ConventionWires.java

Summary

Maintainability
D
1 day
Test Coverage

Method addForwards has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

    public static void addForwards(Component comp, Object controller, char separator) {
        final Class cls = controller.getClass();
        final Method[] mtds = cls.getMethods();
        for (int j = 0; j < mtds.length; ++j) {
            final Method md = mtds[j];
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/util/ConventionWires.java - About 6 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 wireServiceCommand has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static final void wireServiceCommand(final Component comp, final Object controller) {
        Reflections.forMethods(controller.getClass(), Command.class, new Reflections.MethodRunner<Command>() {
            public void onMethod(Class<?> clazz, final Method method, Command annotation) {
                if ((method.getModifiers() & Modifier.STATIC) != 0)
                    throw new UiException("Cannot add forward to static method: " + method.getName());
Severity: Major
Found in zk/src/main/java/org/zkoss/zk/ui/util/ConventionWires.java - About 2 hrs to fix

    Method addForwards has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static void addForwards(Component comp, Object controller, char separator) {
            final Class cls = controller.getClass();
            final Method[] mtds = cls.getMethods();
            for (int j = 0; j < mtds.length; ++j) {
                final Method md = mtds[j];
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/util/ConventionWires.java - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                                  if (srccomp == null) {
                                      Page page = xcomp.getPage();
                                      if (page != null)
                                          srccomp = page.getXelVariable(null, null, srccompid, true);
                                  }
      Severity: Major
      Found in zk/src/main/java/org/zkoss/zk/ui/util/ConventionWires.java - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    if (srccomp == null || !(srccomp instanceof Component)) {
                                        if (log.isDebugEnabled())
                                            log.debug("Cannot find the associated component to forward event: " + mdname);
                                        break;
                                    } else {
        Severity: Major
        Found in zk/src/main/java/org/zkoss/zk/ui/util/ConventionWires.java - About 45 mins to fix

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

              public static final void wireVariables(Component comp, Object controller, char separator, boolean ignoreZScript,
                      boolean ignoreXel) {
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/util/ConventionWires.java - About 35 mins to fix

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

                public static final void wireVariables(Page page, Object controller, char separator, boolean ignoreZScript,
                        boolean ignoreXel) {
            Severity: Minor
            Found in zk/src/main/java/org/zkoss/zk/ui/util/ConventionWires.java - About 35 mins to fix

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

                  public static final void wireFellows(IdSpace idspace, Object controller, char separator, boolean ignoreZScript,
                          boolean ignoreXel) {
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/util/ConventionWires.java - About 35 mins to fix

                There are no issues that match your filters.

                Category
                Status