Showing 3,943 of 3,943 total issues
File SplitJoinServiceImpl.java
has 337 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright © 2014-2017 EntIT Software LLC, a Micro Focus company (L.P.)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
File ExecutionMessage.java
has 325 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright © 2014-2017 EntIT Software LLC, a Micro Focus company (L.P.)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
DependencyServiceImpl
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
@Component
@SuppressWarnings("unused")
public class DependencyServiceImpl implements DependencyService {
private static final Logger logger = LogManager.getLogger(DependencyServiceImpl.class);
Method equals
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
- 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
File WorkerNode.java
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright © 2014-2017 EntIT Software LLC, a Micro Focus company (L.P.)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
File WorkerManager.java
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright © 2014-2017 EntIT Software LLC, a Micro Focus company (L.P.)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
SimpleExecutionRunnable
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
public class SimpleExecutionRunnable implements Runnable {
private static final Logger logger = LogManager.getLogger(SimpleExecutionRunnable.class);
private static final long WORKER_EXECUTION_INTERVAL = Integer.getInteger("worker.executionIntervalSeconds", 60) * 1_000L;
File ExternalPythonExecutorCompletableFutureTimeout.java
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright © 2014-2017 EntIT Software LLC, a Micro Focus company (L.P.)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Method endBranch
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
@Override
@Transactional
public void endBranch(List<Execution> executions) {
Validate.notNull(executions, "executions cannot be 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
File OutboundBufferImpl.java
has 284 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright © 2014-2017 EntIT Software LLC, a Micro Focus company (L.P.)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Method shouldBeRolled
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private boolean shouldBeRolled(PartitionGroup partitionGroup){
if (partitionGroup.getTimeThreshold() != -1){
long lastRoll = System.currentTimeMillis()-partitionGroup.getLastRollTime();
if (logger.isDebugEnabled()) logger.debug("Partition group [" + partitionGroup.getName() + "] was rolled before " + lastRoll + " ms");
- 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 workerKeepAlive
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
@SuppressWarnings("unused")
// Scheduled in xml
public void workerKeepAlive() {
if (!recoveryManager.isInRecovery()) {
if (endOfInit) {
- 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 executeStep
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected String executeStep(Execution execution, ExecutionStep currStep) throws InterruptedException {
try {
final ReadonlyStepActionDataAccessor actionDataAccessor = doPrepareStepData(execution, currStep);
final ControlActionMetadata action = currStep.getAction();
- 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
ExecutionPlan
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
public class ExecutionPlan implements Serializable {
private static final long serialVersionUID = -7685110912034208064L;
protected String flowUuid;
WorkerManager
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
public class WorkerManager implements ApplicationListener, EndExecutionCallback, WorkerRecoveryListener {
private static final Logger logger = LogManager.getLogger(WorkerManager.class);
private static final int KEEP_ALIVE_FAIL_LIMIT = 5;
private static final String DOTNET_PATH = System.getenv("WINDIR") + "/Microsoft.NET/Framework";
Method fillBufferPeriodically
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void fillBufferPeriodically() {
while (!inShutdown) {
try {
boolean workerUp = workerManager.isUp();
if (!workerUp) {
File PythonExecutorLifecycleManagerServiceImpl.java
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright © 2014-2017 EntIT Software LLC, a Micro Focus company (L.P.)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
File PythonExecutor.java
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright © 2014-2017 EntIT Software LLC, a Micro Focus company (L.P.)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
ExternalPythonExecutorScheduledExecutorTimeout
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
public class ExternalPythonExecutorScheduledExecutorTimeout implements ExternalPythonProcessRunService {
private static final Logger logger = LogManager.getLogger(ExternalPythonExecutorScheduledExecutorTimeout.class);
private static final String PYTHON_SCRIPT_FILENAME = "script";
private static final String EVAL_PY = "eval.py";
Identical blocks of code found in 2 locations. Consider refactoring. Open
def __disable_standard_io(self):
old_io = (sys.stdin, sys.stdout, sys.stderr, sys.exit)
sys.stdin, sys.stdout, sys.stderr, sys.exit = (None, None, None, lambda *x, **y: None)
return old_io
- 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 54.
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