File Selectors.java
has 527 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
*
*/
package org.zkoss.zk.ui.select;
Method splitListenAnnotationValues
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
private static String[][] splitListenAnnotationValues(String str) {
List<String[]> result = new ArrayList<String[]>();
int len = str.length();
boolean inSqBracket = false;
boolean inQuote = false;
- 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 injectComponent
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
private void injectComponent(InjectionFunctor injector, Iterable<Component> comps) {
Class<?> type = injector.getType();
boolean isField = injector instanceof FieldFunctor;
// Array
- 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
Selectors
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
public class Selectors {
/**
* Returns an Iterable that iterates through all Components matched by the
* selector.
Method splitListenAnnotationValues
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static String[][] splitListenAnnotationValues(String str) {
List<String[]> result = new ArrayList<String[]>();
int len = str.length();
boolean inSqBracket = false;
boolean inQuote = false;
Method wireEventListeners0
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static void wireEventListeners0(final Component component, final Object controller, final boolean rewire) {
Reflections.forMethods(controller.getClass(), Listen.class, new MethodRunner<Listen>() {
public void onMethod(Class<?> clazz, Method method, Listen anno) {
// check method signature
if ((method.getModifiers() & Modifier.STATIC) != 0)
Method wireComponents
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void wireComponents(final PsdoCompFunctor functor, final boolean ignoreNonNull) {
final Class<?> ctrlClass = _controller.getClass();
// wire to fields
Reflections.forFields(ctrlClass, Wire.class, new FieldRunner<Wire>() {
public void onField(Class<?> clazz, Field field, Wire anno) {
Method injectComponent
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
private void injectComponent(InjectionFunctor injector, Iterable<Component> comps) {
Class<?> type = injector.getType();
boolean isField = injector instanceof FieldFunctor;
// Array
Method wireVariables
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void wireVariables(final PsdoCompFunctor functor, final List<VariableResolver> resolvers) {
Class<?> ctrlClass = _controller.getClass();
// wire to fields
Reflections.forFields(ctrlClass, WireVariable.class, new FieldRunner<WireVariable>() {
public void onField(Class<?> clazz, Field field, WireVariable anno) {
Method newVariableResolvers
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static List<VariableResolver> newVariableResolvers(Class<?> cls, Class<?> untilClass) {
final List<VariableResolver> resolvers = new ArrayList<VariableResolver>();
while (cls != null && cls != untilClass) {
final org.zkoss.zk.ui.select.annotation.VariableResolver anno = cls
.getAnnotation(org.zkoss.zk.ui.select.annotation.VariableResolver.class);
- 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 getObjectByName
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private Object getObjectByName(PsdoCompFunctor functor, String name, Class<?> type,
List<VariableResolver> resolvers) {
Object result = functor.getXelVariable(name);
if (isValidValue(result, type))
- 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
Avoid deeply nested control flow statements. Open
for (EventListener<? extends Event> listener : listeners)
if (listener instanceof ComposerEventListener)
c.removeEventListener(name, listener);
Avoid too many return
statements within this method. Open
return "log";
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return "application";
Avoid too many return
statements within this method. Open
return null;
Method guessImplicitObjectName
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static String guessImplicitObjectName(Class<?> cls) {
if (Execution.class.equals(cls))
return "execution";
if (Page.class.equals(cls))
return "page";
- 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"