zk/src/main/java/org/zkoss/zk/ui/util/ConventionWires.java
Method addForwards
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
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];
- Read upRead up
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
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());
Method addForwards
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
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];
Avoid deeply nested control flow statements. Open
Open
if (srccomp == null) {
Page page = xcomp.getPage();
if (page != null)
srccomp = page.getXelVariable(null, null, srccompid, true);
}
Avoid deeply nested control flow statements. Open
Open
if (srccomp == null || !(srccomp instanceof Component)) {
if (log.isDebugEnabled())
log.debug("Cannot find the associated component to forward event: " + mdname);
break;
} else {
Method wireVariables
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public static final void wireVariables(Component comp, Object controller, char separator, boolean ignoreZScript,
boolean ignoreXel) {
Method wireVariables
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public static final void wireVariables(Page page, Object controller, char separator, boolean ignoreZScript,
boolean ignoreXel) {
Method wireFellows
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public static final void wireFellows(IdSpace idspace, Object controller, char separator, boolean ignoreZScript,
boolean ignoreXel) {