id stringlengths 23 26 | content stringlengths 182 2.49k |
|---|---|
codereview_java_data_13072 | super.visit(node, data);
if (ClassMetricKey.NCSS.supports(node)) {
- int classCount = (int) Metrics.get(ClassMetricKey.NCSS, node);
int classHighest = (int) Metrics.get(OperationMetricKey.NCSS, node, ResultOption.HIGHEST);
- if (classCount >= classReportLevel || classHighest >= methodReportLevel) {
String[] messageParams = {node.getTypeKind().name().toLowerCase(),
node.getImage(),
- classCount + " (Highest = " + classHighest + ")", };
addViolation(data, node, messageParams);
}
Call the variable `methodSize` or just `size`...
super.visit(node, data);
if (ClassMetricKey.NCSS.supports(node)) {
+ int classSize = (int) Metrics.get(ClassMetricKey.NCSS, node);
int classHighest = (int) Metrics.get(OperationMetricKey.NCSS, node, ResultOption.HIGHEST);
+ if (classSize >= classReportLevel || classHighest >= methodReportLevel) {
String[] messageParams = {node.getTypeKind().name().toLowerCase(),
node.getImage(),
+ classSize + " (Highest = " + classHighest + ")", };
addViolation(data, node, messageParams);
} |
codereview_java_data_13080 | private final Logger PROCESS_LOG = LogManager.getLogger("tech.pegasys.pantheon.SubProcessLog");
private final Map<String, Process> pantheonProcesses = new HashMap<>();
- private ExecutorService outputProcessorExecutor = Executors.newCachedThreadPool();
ProcessPantheonNodeRunner() {
Runtime.getRuntime().addShutdownHook(new Thread(this::shutdown));
Why do we need to support creating a new executor service? Shouldn't it only be shutdown after `close` is called? I'd have expected `stop` to leave it running and the cluster can be restarted but `close` should be a very final operation and the cluster shouldn't be used after it's called.
private final Logger PROCESS_LOG = LogManager.getLogger("tech.pegasys.pantheon.SubProcessLog");
private final Map<String, Process> pantheonProcesses = new HashMap<>();
+ private final ExecutorService outputProcessorExecutor = Executors.newCachedThreadPool();
ProcessPantheonNodeRunner() {
Runtime.getRuntime().addShutdownHook(new Thread(this::shutdown)); |
codereview_java_data_13083 | .endFileIndex(END_FILE_INDEX)
.build();
}
-}
\ No newline at end of file
are we reading the images from current directory in this setting?
.endFileIndex(END_FILE_INDEX)
.build();
}
\ No newline at end of file
+} |
codereview_java_data_13094 | try {
hook.consumeMessageBefore(context);
} catch (Throwable e) {
}
}
}
Swallowing exceptions is not a good practice
try {
hook.consumeMessageBefore(context);
} catch (Throwable e) {
+ log.error("consumeMessageHook {} executeHookBefore exception", hook.hookName(), e);
}
}
} |
codereview_java_data_13098 | } else {
if (term.equals(result)) {
kem.registerCriticalWarning("Step " + step + ": infinite loop after applying a spec rule.");
- proofResults.add(result);
}
}
continue;
this is not a bug, this is intended: we only verify properties of terminating executions (partial correctness). We could check that all executions terminate (total correctness), using ranking functions. However, this checks a very particular case, so I'm ok we keeping the warning, but not with adding it to `proofResults`.
} else {
if (term.equals(result)) {
kem.registerCriticalWarning("Step " + step + ": infinite loop after applying a spec rule.");
}
}
continue; |
codereview_java_data_13103 | * deselected (false)
*/
private void setSelected(WebElement option, boolean select) {
- if ((!option.isSelected() && select) || (option.isSelected() && !select)) {
option.click();
}
}
it's not efficient to make the remote call to isSelected multiple times here. Please either revert the change to this method or store the isSelected value in a local variable.
* deselected (false)
*/
private void setSelected(WebElement option, boolean select) {
+ boolean isSelected=option.isSelected();
+ if ((!isSelected && select) || (isSelected && !select)) {
option.click();
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.