Exec
has 100 methods (exceeds 20 allowed). Consider refactoring. Open
private static class Exec implements Execution {
private static final Execution exec() {
return Executions.getCurrent();
}
File Components.java
has 743 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* Components.java
Purpose:
Description:
Method getImplicit
has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring. Open
public static Object getImplicit(Page page, Component comp, String name) {
if (comp != null && page == null)
page = getCurrentPage(comp);
if ("log".equals(name))
- 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
Components
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
public class Components {
private static final Logger _zklog = LoggerFactory.getLogger("org.zkoss.zk.log");
protected Components() {
}
Method componentToPath
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public static final String componentToPath(Component comp, Component ref) {
//Implementation Note:
//The path being written is a bit different to Path, if ref
//is not an space owner
//For example, if comp is the space owner, "" is written.
- 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 getVisibleChildren
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public static Collection<Component> getVisibleChildren(Component comp) {
final Collection<Component> children = comp.getChildren();
return new AbstractCollection<Component>() {
public int size() {
int size = 0;
- 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 getImplicit
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static Object getImplicit(Page page, Component comp, String name) {
if (comp != null && page == null)
page = getCurrentPage(comp);
if ("log".equals(name))
Method sort
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static void sort(List<? extends Component> list, int from, int to, Comparator<? super Component> cpr) {
final Component[] ary = CollectionsX.toArray(list, new Component[0], from, to);
Arrays.sort(ary, cpr);
ListIterator<? extends Component> it = list.listIterator(from);
- 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 getVisibleChildren
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static Collection<Component> getVisibleChildren(Component comp) {
final Collection<Component> children = comp.getChildren();
return new AbstractCollection<Component>() {
public int size() {
int size = 0;
Method componentToPath
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static final String componentToPath(Component comp, Component ref) {
//Implementation Note:
//The path being written is a bit different to Path, if ref
//is not an space owner
//For example, if comp is the space owner, "" is written.
Method iterator
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public Iterator<Component> iterator() {
return new Iterator<Component>() {
final Iterator<Component> _it = children.iterator();
Component _next;
- 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 getComposer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static Composer getComposer(Component comp) {
if (comp != null) {
Object onm = comp.getAttribute("composerName");
if (onm instanceof String && ((String) onm).length() > 0) {
return (Composer) comp.getAttribute((String) onm);
- 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 createComponentsDirectly
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public Component createComponentsDirectly(Document content, String extension, Component parent,
Component insertBefore, VariableResolver resolver) {
Method createComponentsDirectly
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public Component createComponentsDirectly(String content, String extension, Component parent,
Component insertBefore, VariableResolver resolver) {
Method createComponentsDirectly
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public Component createComponentsDirectly(Reader reader, String extension, Component parent,
Component insertBefore, VariableResolver resolver) throws IOException {
Method createComponents
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public Component[] createComponents(String uri, Component parent, Component insertBefore,
VariableResolver resolver, Map<?, ?> arg) {
Method getScope
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static final int getScope(String scope) {
if ("component".equals(scope))
return Component.COMPONENT_SCOPE;
if ("space".equals(scope))
return Component.SPACE_SCOPE;
- 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 too many return
statements within this method. Open
return app != null ? app.getAttributes() : Collections.EMPTY_MAP;
Avoid too many return
statements within this method. Open
return EXECUTION_PROXY;
Avoid too many return
statements within this method. Open
return Component.SESSION_SCOPE;
Avoid too many return
statements within this method. Open
return comp != null ? getDesktop(comp) : page.getDesktop();
Avoid too many return
statements within this method. Open
return exec != null ? exec.getArg() : null;
Avoid too many return
statements within this method. Open
return scope != null ? scope.getAttributes() : Collections.EMPTY_MAP;
Avoid too many return
statements within this method. Open
return sess != null ? sess.getAttributes() : Collections.EMPTY_MAP;
Avoid too many return
statements within this method. Open
return exec != null ? exec.getParameterMap() : null;
Avoid too many return
statements within this method. Open
return Component.APPLICATION_SCOPE;
Avoid too many return
statements within this method. Open
return exec != null ? exec.getAttributes() : Collections.EMPTY_MAP;
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return comp != null ? comp.getAttributes() : Collections.EMPTY_MAP;
Avoid too many return
statements within this method. Open
return REQUEST_SCOPE_PROXY;
Avoid too many return
statements within this method. Open
return comp != null ? getSession(comp) : page.getDesktop().getSession();
Avoid too many return
statements within this method. Open
return page != null ? page.getAttributes() : Collections.EMPTY_MAP;
Avoid too many return
statements within this method. Open
return dt != null ? dt.getAttributes() : Collections.EMPTY_MAP;
Avoid too many return
statements within this method. Open
return comp != null ? getWebApp(comp) : page.getDesktop().getWebApp();
Avoid too many return
statements within this method. Open
return Component.REQUEST_SCOPE;
Method replace
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static void replace(Component oldc, Component newc) {
final Component p = oldc.getParent(), sib = oldc.getNextSibling();
if (p != null) {
oldc.detach();
p.insertBefore(newc, sib);
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
public static Page getCurrentPage(Component comp) {
if (comp != null) {
Page page = comp.getPage();
if (page != null)
return page;
- Read upRead up
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 63.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ("sessionScope".equals(name)) {
final Session sess = comp != null ? getSession(comp) : page.getDesktop().getSession();
return sess != null ? sess.getAttributes() : Collections.EMPTY_MAP;
}
- Read upRead up
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 52.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ("applicationScope".equals(name)) {
final WebApp app = comp != null ? getWebApp(comp) : page.getDesktop().getWebApp();
return app != null ? app.getAttributes() : Collections.EMPTY_MAP;
}
- Read upRead up
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 52.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public boolean equals(Object o) {
if (this == o)
return true;
if (o instanceof Exec)
return Objects.equals(exec(), ((Exec) o).exec());
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public boolean equals(Object o) {
if (this == o)
return true;
if (o instanceof RequestScope)
return Objects.equals(req(), ((RequestScope) o).req());
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
final String[] names = { "application", "applicationScope", "arg", "componentScope", "desktop", "desktopScope",
"execution", "event", //since 3.6.1, #bug 2681819: normal page throws exception after installed zkspring
"self", "session", "sessionScope", "spaceOwner", "spaceScope", "page", "pageScope", "requestScope",
"param" };
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76