AbstractExecution
has 74 methods (exceeds 20 allowed). Consider refactoring. Open
public abstract class AbstractExecution implements Execution, ExecutionCtrl {
private static final Logger _zklog = LoggerFactory.getLogger("org.zkoss.zk.log");
private Desktop _desktop;
private Page _curpage;
File AbstractExecution.java
has 487 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* AbstractExecution.java
Purpose:
Description:
Method getExtraXelVariable
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public Object getExtraXelVariable(XelContext ctx, Object base, Object name) {
//Note this method searches only _resolvers
if (_resolvers != null) {
for (Iterator it = CollectionsX.comodifiableIterator(_resolvers); it.hasNext();) {
final VariableResolver vr = (VariableResolver) it.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 setAttribute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public Object setAttribute(String name, Object value, boolean recurse) {
if (recurse && !hasAttribute(name)) {
Desktop desktop = getDesktop();
if (desktop != null) {
if (desktop.hasAttribute(name, true))
- 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 removeAttribute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public Object removeAttribute(String name, boolean recurse) {
if (recurse && !hasAttribute(name)) {
Desktop desktop = getDesktop();
if (desktop != null) {
if (desktop.hasAttribute(name, true))
- 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 toAbsoluteURI
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public String toAbsoluteURI(String uri, boolean skipInclude) {
if (uri != null && uri.length() > 0) {
final char cc = uri.charAt(0);
if (cc != '/' && cc != '~' && !(skipInclude && isIncluded()) && !Servlets.isUniversalURL(uri)) {
final String dir = getDesktop().getCurrentDirectory();
- 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 createComponentsDirectly0
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private Component createComponentsDirectly0(Document content, String ext, Component parent, Component insertBefore,
VariableResolver resolver, Map<?, ?> arg) {
Method createComponentsDirectly0
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private Component createComponentsDirectly0(String content, String ext, Component parent, Component insertBefore,
VariableResolver resolver, Map<?, ?> arg) {
Method createComponentsDirectly0
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private Component createComponentsDirectly0(Reader reader, String ext, Component parent, Component insertBefore,
VariableResolver resolver, Map<?, ?> arg) throws IOException {
Method createComponentsDirectly
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public Component createComponentsDirectly(String content, String ext, Component parent, Component insertBefore,
VariableResolver resolver) {
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 createComponents0
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private Component createComponents0(String uri, Component parent, Component insertBefore, VariableResolver resolver,
Map<?, ?> arg) {
Method createComponentsDirectly
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public Component createComponentsDirectly(Reader reader, String ext, Component parent, Component insertBefore,
VariableResolver resolver) throws IOException {
Method createComponents0
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private Component createComponents0(PageDefinition pagedef, Component parent, Component insertBefore,
VariableResolver resolver, Map<?, ?> arg) {
Method createComponentsDirectly
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public Component createComponentsDirectly(Document content, String ext, Component parent, Component insertBefore,
VariableResolver resolver) {
Method sendRedirect
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public void sendRedirect(String uri, boolean respRedirect) {
if (!respRedirect) {
sendRedirect(uri);
return;
} else {
- 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 onActivate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
public void onActivate() {
if (_desktop != null) {
List<Callback> callbacks = (List<Callback>) _desktop.getAttribute(Add_ON_ACTIVATE);
if (callbacks != null) {
- 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 onBeforeDeactivate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
public void onBeforeDeactivate() {
if (_desktop != null) {
List<Callback> callbacks = (List<Callback>) _desktop.getAttribute(Add_ON_DEACTIVATE);
if (callbacks != null) {
- 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 hasVariableResolver
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public boolean hasVariableResolver(Class<? extends VariableResolver> cls) {
if (_resolvers != null)
for (final VariableResolver resolver : _resolvers)
if (cls.isInstance(resolver))
return true;
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
public void addOnActivate(Callback callback) {
Execution exec = Executions.getCurrent();
if (exec == null)
throw new IllegalStateException("Execution cannot be null!");
Desktop desktop = exec.getDesktop();
- 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 98.
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 void addOnDeactivate(Callback callback) {
Execution exec = Executions.getCurrent();
if (exec == null)
throw new IllegalStateException("Execution cannot be null!");
Desktop desktop = exec.getDesktop();
- 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 98.
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
@SuppressWarnings("unchecked")
public void onActivate() {
if (_desktop != null) {
List<Callback> callbacks = (List<Callback>) _desktop.getAttribute(Add_ON_ACTIVATE);
if (callbacks != null) {
- 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 77.
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
@SuppressWarnings("unchecked")
public void onBeforeDeactivate() {
if (_desktop != null) {
List<Callback> callbacks = (List<Callback>) _desktop.getAttribute(Add_ON_DEACTIVATE);
if (callbacks != null) {
- 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 77.
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 3 locations. Consider refactoring. Open
private Component createComponentsDirectly0(String content, String ext, Component parent, Component insertBefore,
VariableResolver resolver, Map<?, ?> arg) {
final Component[] cs = getUiEngine().createComponents(this, getPageDefinitionDirectly(content, ext),
getCurrentPage(), parent, insertBefore, resolver, arg);
return cs.length > 0 ? cs[0] : null;
- 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 57.
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 3 locations. Consider refactoring. Open
private Component createComponentsDirectly0(Reader reader, String ext, Component parent, Component insertBefore,
VariableResolver resolver, Map<?, ?> arg) throws IOException {
final Component[] cs = getUiEngine().createComponents(this, getPageDefinitionDirectly(reader, ext),
getCurrentPage(), parent, insertBefore, resolver, arg);
return cs.length > 0 ? cs[0] : null;
- 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 57.
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 3 locations. Consider refactoring. Open
private Component createComponentsDirectly0(Document content, String ext, Component parent, Component insertBefore,
VariableResolver resolver, Map<?, ?> arg) {
final Component[] cs = getUiEngine().createComponents(this, getPageDefinitionDirectly(content, ext),
getCurrentPage(), parent, insertBefore, resolver, arg);
return cs.length > 0 ? cs[0] : null;
- 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 57.
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