File UiEngineImpl.java
has 2078 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* UiEngineImpl.java
Purpose:
Description:
UiEngineImpl
has 103 methods (exceeds 20 allowed). Consider refactoring. Open
public class UiEngineImpl implements UiEngine {
/*package*/ static final Logger log = LoggerFactory.getLogger(UiEngineImpl.class);
/** The Web application this engine belongs to. */
private WebApp _wapp;
Method execNewPage0
has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring. Open
private void execNewPage0(final Execution exec, final PageDefinition pagedef, final Richlet richlet,
final Page page, final Writer out) throws IOException {
//Update the device type first. If this is the second page and not
//belonging to the same device type, an exception is thrown
final Desktop desktop = exec.getDesktop();
- 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 execCreate0
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
private static final Component[] execCreate0(CreateInfo ci, NodeInfo parentInfo, Component parent,
Component insertBefore) {
final List<Component> created = new LinkedList<Component>();
final Page page = ci.page;
final PageDefinition pagedef = parentInfo.getPageDefinition();
- 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 getNativeContent
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
private static final void getNativeContent(CreateInfo ci, StringBuffer sb, Component comp, List<NodeInfo> children,
Native.Helper helper) {
for (NodeInfo meta : children) {
if (meta instanceof NativeInfo) {
final NativeInfo childInfo = (NativeInfo) meta;
- 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 execNewPage0
has 181 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void execNewPage0(final Execution exec, final PageDefinition pagedef, final Richlet richlet,
final Page page, final Writer out) throws IOException {
//Update the device type first. If this is the second page and not
//belonging to the same device type, an exception is thrown
final Desktop desktop = exec.getDesktop();
Method meterAuClient
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
private static void meterAuClient(PerformanceMeter pfmeter, Execution exec, String hdr, boolean complete) {
for (int j = 0;;) {
int k = hdr.indexOf(',', j);
String ids = k >= 0 ? hdr.substring(j, k) : j == 0 ? hdr : hdr.substring(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 execUpdate
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
public void execUpdate(Execution exec, List<AuRequest> requests, AuWriter out) throws IOException {
if (requests == null)
throw new IllegalArgumentException();
// assert ExecutionsCtrl.getCurrentCtrl() == null:
// "Impossible to re-activate for update: old="+ExecutionsCtrl.getCurrentCtrl()+", new="+exec;
- 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 doActivate
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
private static UiVisualizer doActivate(Execution exec, boolean asyncupd, boolean recovering,
Object[] resultOfRepeat, int timeout) {
if (Executions.getCurrent() != null)
throw new IllegalStateException("Use doReactivate instead");
// assert !recovering || !asyncupd; //Not support both asyncupd and recovering are true yet
- 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 handleError
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
private static final void handleError(Throwable ex, UiVisualizer uv, List<Throwable> errs) {
final Throwable t = Exceptions.findCause(ex, Expectable.class);
if (t == null) {
if (ex instanceof org.xml.sax.SAXException
|| ex instanceof org.zkoss.zk.ui.metainfo.PropertyNotFoundException)
- 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 execCreateChild0
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
private static Component execCreateChild0(CreateInfo ci, Component parent, ComponentInfo childInfo,
String replaceableText, Component insertBefore) {
Composer composer = childInfo.resolveComposer(ci.page, parent);
ComposerExt composerExt = null;
boolean bPopComposer = 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 execUpdate
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void execUpdate(Execution exec, List<AuRequest> requests, AuWriter out) throws IOException {
if (requests == null)
throw new IllegalArgumentException();
// assert ExecutionsCtrl.getCurrentCtrl() == null:
// "Impossible to re-activate for update: old="+ExecutionsCtrl.getCurrentCtrl()+", new="+exec;
Method init
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
private void init() {
_uri = null;
final List<Object[]> results = new LinkedList<Object[]>();
for (int j = 0, len = _fulfill.length();;) {
int k = 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 processEvent
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private void processEvent(Desktop desktop, Component comp, Event event) {
final Configuration config = desktop.getWebApp().getConfiguration();
if (config.isEventThreadEnabled()) {
EventProcessingThreadImpl evtthd = null;
synchronized (_idles) {
- 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 resumeAll
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
private void resumeAll(Desktop desktop, UiVisualizer uv, List<Throwable> errs) {
//We have to loop because a resumed thread might resume others
while (!_resumed.isEmpty()) { //no need to sync (better performance)
final List<EventProcessingThreadImpl> list;
synchronized (_resumed) {
- 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 execSwitch
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
private static Component[] execSwitch(CreateInfo ci, ZkInfo switchInfo, Component parent, Component insertBefore) {
final Page page = ci.page;
if (!switchInfo.getChildren().isEmpty()) {
final Object switchCond = switchInfo.resolveSwitch(page, parent);
- 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 createComponents
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public Component[] createComponents(Execution exec, PageDefinition pagedef, Page page, Component parent,
Component insertBefore, VariableResolver resolver, Map<?, ?> arg) {
if (pagedef == null)
throw new IllegalArgumentException("pagedef");
- 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 execCreateChild0
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static Component execCreateChild0(CreateInfo ci, Component parent, ComponentInfo childInfo,
String replaceableText, Component insertBefore) {
Composer composer = childInfo.resolveComposer(ci.page, parent);
ComposerExt composerExt = null;
boolean bPopComposer = false;
Method doActivate
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static UiVisualizer doActivate(Execution exec, boolean asyncupd, boolean recovering,
Object[] resultOfRepeat, int timeout) {
if (Executions.getCurrent() != null)
throw new IllegalStateException("Use doReactivate instead");
// assert !recovering || !asyncupd; //Not support both asyncupd and recovering are true yet
Method execNonComponent
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private static final void execNonComponent(CreateInfo ci, Component comp, Object meta) {
final Page page = ci.page;
if (meta instanceof AttributesInfo) {
final AttributesInfo attrs = (AttributesInfo) meta;
if (comp != 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 execCreate0
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static final Component[] execCreate0(CreateInfo ci, NodeInfo parentInfo, Component parent,
Component insertBefore) {
final List<Component> created = new LinkedList<Component>();
final Page page = ci.page;
final PageDefinition pagedef = parentInfo.getPageDefinition();
Method mergeResponses
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private List<AuResponse> mergeResponses(List<AuResponse> responses) {
if (responses.size() >= 2) { // worth merging
List<AuSetAttribute> bulk = new LinkedList<>();
ListIterator<AuResponse> iterator = responses.listIterator();
Object previousDepends = null, currentDepends = 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 createComponents
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Component[] createComponents(Execution exec, PageDefinition pagedef, Page page, Component parent,
Component insertBefore, VariableResolver resolver, Map<?, ?> arg) {
if (pagedef == null)
throw new IllegalArgumentException("pagedef");
Method visualizeErrors
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private final void visualizeErrors(Execution exec, UiVisualizer uv, List<Throwable> errs) {
final StringBuffer sb = new StringBuffer(128);
for (Throwable t : errs) {
if (sb.length() > 0)
sb.append('\n');
- 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 desktopDestroyed0
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private void desktopDestroyed0(Desktop desktop) {
final Configuration config = _wapp.getConfiguration();
if (!_suspended.isEmpty()) { //no need to sync (better performance)
final Map<Object, List<EventProcessingThreadImpl>> map;
synchronized (_suspended) {
- 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 isCaseMatched
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static boolean isCaseMatched(ZkInfo caseInfo, Page page, Component parent, Object switchCond) {
if (!caseInfo.withCase())
return true; //default clause
final Object[] caseValues = caseInfo.resolveCase(page, parent);
- 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 execCreateChild
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static Component[] execCreateChild(CreateInfo ci, Component parent, ComponentInfo childInfo,
ReplaceableText replaceableText, Component insertBefore) {
final ComponentDefinition childdef = childInfo.getComponentDefinition();
if (childdef.isInlineMacro()) {
if (insertBefore != 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 handleError
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static final void handleError(Throwable ex, UiVisualizer uv, List<Throwable> errs) {
final Throwable t = Exceptions.findCause(ex, Expectable.class);
if (t == null) {
if (ex instanceof org.xml.sax.SAXException
|| ex instanceof org.zkoss.zk.ui.metainfo.PropertyNotFoundException)
Method visualizeErrors
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
private final void visualizeErrors(Execution exec, UiVisualizer uv, List<Throwable> errs) {
final StringBuffer sb = new StringBuffer(128);
for (Throwable t : errs) {
if (sb.length() > 0)
sb.append('\n');
Method execCreate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private static final Component[] execCreate(CreateInfo ci, NodeInfo parentInfo, Component parent,
Component insertBefore) {
String fulfillURI = null;
if (parentInfo instanceof ComponentInfo) {
final ComponentInfo pi = (ComponentInfo) parentInfo;
- 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 processEvent
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void processEvent(Desktop desktop, Component comp, Event event) {
final Configuration config = desktop.getWebApp().getConfiguration();
if (config.isEventThreadEnabled()) {
EventProcessingThreadImpl evtthd = null;
synchronized (_idles) {
Method getNativeContent
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static final void getNativeContent(CreateInfo ci, StringBuffer sb, Component comp, List<NodeInfo> children,
Native.Helper helper) {
for (NodeInfo meta : children) {
if (meta instanceof NativeInfo) {
final NativeInfo childInfo = (NativeInfo) meta;
Method wait
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void wait(Object mutex) throws InterruptedException, SuspendNotAllowedException {
if (mutex == null)
throw new IllegalArgumentException("null mutex");
final Thread thd = Thread.currentThread();
Method create
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Component[] create(Component parent, Component insertBefore, VariableResolver resolver,
Composer composer) {
final Execution exec = Executions.getCurrent();
final ExecutionCtrl execCtrl = (ExecutionCtrl) exec;
final Component[] cs;
Method execNonComponent
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static final void execNonComponent(CreateInfo ci, Component comp, Object meta) {
final Page page = ci.page;
if (meta instanceof AttributesInfo) {
final AttributesInfo attrs = (AttributesInfo) meta;
if (comp != null)
Method endUpdate
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public void endUpdate(Execution exec) throws IOException {
final Desktop desktop = exec.getDesktop();
final DesktopCtrl desktopCtrl = (DesktopCtrl) desktop;
final Configuration config = desktop.getWebApp().getConfiguration();
final ExecutionCtrl execCtrl = (ExecutionCtrl) exec;
- 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 wait
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public void wait(Object mutex) throws InterruptedException, SuspendNotAllowedException {
if (mutex == null)
throw new IllegalArgumentException("null mutex");
final Thread thd = Thread.currentThread();
- 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 create
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public Component[] create(Component parent, Component insertBefore, VariableResolver resolver,
Composer composer) {
final Execution exec = Executions.getCurrent();
final ExecutionCtrl execCtrl = (ExecutionCtrl) exec;
final Component[] cs;
- 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 getRetryTimeout
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private static final int getRetryTimeout() {
if (_retryTimeout == null) {
int v = 0;
final String s = Library.getProperty(Attributes.ACTIVATE_RETRY_DELAY);
if (s != 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 endUpdate
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void endUpdate(Execution exec) throws IOException {
final Desktop desktop = exec.getDesktop();
final DesktopCtrl desktopCtrl = (DesktopCtrl) desktop;
final Configuration config = desktop.getWebApp().getConfiguration();
final ExecutionCtrl execCtrl = (ExecutionCtrl) exec;
Method init
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void init() {
_uri = null;
final List<Object[]> results = new LinkedList<Object[]>();
for (int j = 0, len = _fulfill.length();;) {
int k = j;
Method mergeResponses
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
private List<AuResponse> mergeResponses(List<AuResponse> responses) {
if (responses.size() >= 2) { // worth merging
List<AuSetAttribute> bulk = new LinkedList<>();
ListIterator<AuResponse> iterator = responses.listIterator();
Object previousDepends = null, currentDepends = null;
Method desktopDestroyed0
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void desktopDestroyed0(Desktop desktop) {
final Configuration config = _wapp.getConfiguration();
if (!_suspended.isEmpty()) { //no need to sync (better performance)
final Map<Object, List<EventProcessingThreadImpl>> map;
synchronized (_suspended) {
Method process
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private void process(Desktop desktop, Event event) {
// if (log.finable()) log.finer("Processing event: "+event);
final Component comp;
if (event instanceof ProxyEvent) {
- 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 recycleDesktop
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void recycleDesktop(Execution exec, Page page, Writer out) throws IOException {
PerformanceMeter pfmeter = page.getDesktop().getWebApp().getConfiguration().getPerformanceMeter();
final long startTime = pfmeter != null ? System.currentTimeMillis() : 0;
final String pfReqId = pfmeter != null ? meterLoadStart(pfmeter, exec, startTime) : null;
Method meterAuClient
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static void meterAuClient(PerformanceMeter pfmeter, Execution exec, String hdr, boolean complete) {
for (int j = 0;;) {
int k = hdr.indexOf(',', j);
String ids = k >= 0 ? hdr.substring(j, k) : j == 0 ? hdr : hdr.substring(j);
Method doDeactivate
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static final void doDeactivate(Execution exec) {
// if (log.finerable()) log.finer("Deactivating "+desktop);
final ExecutionCtrl execCtrl = (ExecutionCtrl) exec;
final Desktop desktop = exec.getDesktop();
Method recycleDesktop
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public void recycleDesktop(Execution exec, Page page, Writer out) throws IOException {
PerformanceMeter pfmeter = page.getDesktop().getWebApp().getConfiguration().getPerformanceMeter();
final long startTime = pfmeter != null ? System.currentTimeMillis() : 0;
final String pfReqId = pfmeter != null ? meterLoadStart(pfmeter, exec, startTime) : 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 stop
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public void stop(WebApp wapp) {
synchronized (_idles) {
for (EventProcessingThreadImpl thread : _idles)
thread.cease("Stop application");
_idles.clear();
- 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 resumeAll
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void resumeAll(Desktop desktop, UiVisualizer uv, List<Throwable> errs) {
//We have to loop because a resumed thread might resume others
while (!_resumed.isEmpty()) { //no need to sync (better performance)
final List<EventProcessingThreadImpl> list;
synchronized (_resumed) {
Method meterAuStart
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private static String meterAuStart(PerformanceMeter pfmeter, Execution exec, long startTime) {
//Format of ZK-Client-Start:
// request-id=time
String hdr = meterGetData(exec, "ZK-Client-Start");
if (hdr != 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 createComponents
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public Component[] createComponents(Execution exec, PageDefinition pagedef, Page page, Component parent,
Component insertBefore, VariableResolver resolver, Map<?, ?> arg) {
Method getDestroyTimeout
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static final int getDestroyTimeout() {
if (_destroyTimeout == null) {
int v = 0;
final String s = Library.getProperty("org.zkoss.zk.ui.activate.wait.destroy.timeout");
if (s != 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 finishUpdate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public JSONArray finishUpdate(Object ctx, List<Throwable> errs) throws IOException {
final UpdateInfo ui = (UpdateInfo) ctx;
final Execution exec = ui.uv.getExecution();
final Desktop desktop = exec.getDesktop();
- 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 ceaseSuspendedThread
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public boolean ceaseSuspendedThread(Desktop desktop, EventProcessingThread evtthd, String cause) {
final Map<Object, List<EventProcessingThreadImpl>> map;
synchronized (_suspended) {
map = _suspended.get(desktop);
}
- 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
if (isEffective(childInfo, page, parent)) {
final Component[] children = execCreateChild(ci, parent, childInfo, replaceableText,
insertBefore);
Collections.addAll(created, children);
}
Method execCreateChild
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static Component[] execCreateChild(CreateInfo ci, Component parent, ComponentInfo childInfo,
ReplaceableText replaceableText, Component insertBefore) {
Method getNativeContent
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static final void getNativeContent(CreateInfo ci, StringBuffer sb, Component comp, List<NodeInfo> children,
Native.Helper helper) {
Method getNativeSecondHalf
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static final void getNativeSecondHalf(CreateInfo ci, StringBuffer sb, Component comp, NativeInfo childInfo,
Native.Helper helper) {
Method execCreateChild0
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static Component execCreateChild0(CreateInfo ci, Component parent, ComponentInfo childInfo,
String replaceableText, Component insertBefore) {
Method doActivate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static UiVisualizer doActivate(Execution exec, boolean asyncupd, boolean recovering,
Object[] resultOfRepeat, int timeout) {
Method execNewPage0
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private void execNewPage0(final Execution exec, final PageDefinition pagedef, final Richlet richlet,
final Page page, final Writer out) throws IOException {
Method execCreateChild
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static Component[] execCreateChild(CreateInfo ci, Component parent, ZkInfo childInfo,
ReplaceableText replaceableText, Component insertBefore) {
Method getNativeFirstHalf
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static final void getNativeFirstHalf(CreateInfo ci, StringBuffer sb, Component comp, NativeInfo childInfo,
Native.Helper helper) {
Method recycleEventThread
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private void recycleEventThread(EventProcessingThreadImpl evtthd) {
if (!evtthd.isCeased()) {
if (evtthd.isIdle()) {
final int max = _wapp.getConfiguration().getMaxSpareThreads();
synchronized (_idles) {
- 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 setEpilog
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static final void setEpilog(CreateInfo ci, Component comp, NativeInfo compInfo) {
final Native nc = (Native) comp;
final Native.Helper helper = nc.getHelper();
StringBuffer sb = null;
final NativeInfo splitInfo = compInfo.getSplitChild();
- 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 setProlog
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static final void setProlog(CreateInfo ci, Component comp, NativeInfo compInfo) {
final Native nc = (Native) comp;
final Native.Helper helper = nc.getHelper();
StringBuffer sb = null;
final List<NodeInfo> prokids = compInfo.getPrologChildren();
- 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 hasSuspendedThread
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public boolean hasSuspendedThread() {
if (!_suspended.isEmpty()) {
synchronized (_suspended) {
for (Map map : _suspended.values())
if (!map.isEmpty())
- 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
} else if (meta instanceof ZkInfo) {
final ZkInfo childInfo = (ZkInfo) meta;
final ForEach forEach = childInfo.resolveForEach(page, parent);
if (forEach == null) {
if (isEffective(childInfo, page, parent)) {
- 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 126.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (meta instanceof ComponentInfo) {
final ComponentInfo childInfo = (ComponentInfo) meta;
final ForEach forEach = childInfo.resolveForEach(page, parent);
if (forEach == null) {
if (isEffective(childInfo, page, parent)) {
- 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 126.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
} catch (Throwable ex) {
final List<Throwable> errs = new LinkedList<Throwable>();
errs.add(ex);
desktopCtrl.invokeExecutionCleanups(exec, null, errs);
- 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 88.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
} catch (Throwable ex) {
final List<Throwable> errs = new LinkedList<Throwable>();
errs.add(ex);
desktopCtrl.invokeExecutionCleanups(exec, null, errs);
- 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 88.
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
Identical blocks of code found in 3 locations. Consider refactoring. Open
do {
for (; event != null; event = nextEvent(uv)) {
try {
process(desktop, event);
} catch (Throwable ex) {
- 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 72.
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
Identical blocks of code found in 3 locations. Consider refactoring. Open
do {
for (; event != null; event = nextEvent(uv)) {
try {
process(desktop, event);
} catch (Throwable ex) {
- 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 72.
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
Identical blocks of code found in 3 locations. Consider refactoring. Open
do {
for (; event != null; event = nextEvent(uv)) {
try {
process(desktop, event);
} catch (Throwable ex) {
- 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 72.
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
private static class ExtensionHolder {
private static final Extension INSTANCE = initializeExtension();
private static Extension initializeExtension() {
String clsnm = Library.getProperty("org.zkoss.zk.ui.impl.UiEngineImpl.extension");
- 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 69.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
synchronized (map) {
List<EventProcessingThreadImpl> list = map.get(mutex);
if (list == null)
map.put(mutex, list = new LinkedList<EventProcessingThreadImpl>());
list.add(evtthd);
- 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 44.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
while (forEach.next()) {
if (childInfo.isEffective(comp)) {
getNativeFirstHalf(ci, sb, comp, childInfo, helper);
getNativeSecondHalf(ci, sb, comp, childInfo, helper);
}
- 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 40.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (forEach == null) {
if (childInfo.isEffective(comp)) {
getNativeFirstHalf(ci, sb, comp, childInfo, helper);
getNativeSecondHalf(ci, sb, comp, childInfo, helper);
}
- 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 40.
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