Showing 3,943 of 3,943 total issues
Method execute
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public Execution execute(Execution execution) throws InterruptedException {
try {
// Handle cancel or pause of execution
if (handleCancelledFlow(execution)
Method cancelPausedRun
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private void cancelPausedRun(ExecutionState executionStateToCancel) {
final List<ExecutionState> branches = executionStateService.readByExecutionId(executionStateToCancel.getExecutionId());
// If the parent is paused because one of the branches is paused, OR, it was paused by the user / no-workers-in-group, but has branches that were not finished (and thus, were paused) -
// The parent itself will return to the queue after all the branches are ended (due to this cancellation), and then it'll be canceled as well.
- 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 unzipToFolder
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static void unzipToFolder(String folderPath, InputStream source) {
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
File mavenHome = new File(folderPath);
if(!mavenHome.exists()) {
try (ZipInputStream zio = new ZipInputStream(source)) {
- 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 transformExecutionParameters
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private Object[] transformExecutionParameters(Object[] oldExecutionParameters, Method executionMethod)
throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException,
InvocationTargetException, InstantiationException {
// this method relies on the current SerializableSessionObject from the SDK
// if the object changes in the future, we need to align the logic here
- 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
Function __init_context
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init_context(self, payload):
global sys_prop
global get_sp
global get
global cs_append
Method doRecovery
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void doRecovery(){
try {
boolean toRestart = Boolean.getBoolean("cloudslang.worker.restart.on.recovery");
//If we are configured to restart on recovery - do shutdown
if(toRestart){
Method run
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void run() {
String executionId = executionMessage.getMsgId();
// Get thread reference only once, since Thread.currentThread() is a native method
final Thread currentThreadRef = currentThread();
Similar blocks of code found in 2 locations. Consider refactoring. Open
@Override
public void onPoll(List<ExecutionMessage> messages, int queueSize) {
if (logger.isDebugEnabled()) {
logger.debug("poll " + messages.size() + " messages:");
logger.debug("queue size: " + queueSize);
- 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 101.
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
@Override
public void onEnqueue(List<ExecutionMessage> messages, int queueSize) {
if (logger.isDebugEnabled()) {
logger.debug("Enqueue " + messages.size() + " messages:");
logger.debug("queue size: " + queueSize);
- 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 101.
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
private TempExecutionEnvironment generateTempResourcesForExec(String script) throws IOException {
Path execTempDirectory = Files.createTempDirectory("python_execution");
File tempUserScript = File.createTempFile(PYTHON_SCRIPT_FILENAME, PYTHON_SUFFIX, execTempDirectory.toFile());
FileUtils.writeStringToFile(tempUserScript, script, UTF_8);
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
private TempExecutionEnvironment generateTempResourcesForExec(String script) throws IOException {
Path execTempDirectory = Files.createTempDirectory("python_execution");
File tempUserScript = File.createTempFile(PYTHON_SCRIPT_FILENAME, PYTHON_SUFFIX, execTempDirectory.toFile());
FileUtils.writeStringToFile(tempUserScript, script, UTF_8);
- 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
Method doStartup
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void doStartup() {
new Thread(new Runnable() {
@Override
public void run() {
initStarted = true;
Method resolveJythonObjectToJava
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private Serializable resolveJythonObjectToJava(PyObject value, String errorMessage) {
if (value == null) {
return null;
} else if (value instanceof PyBoolean) {
PyBoolean pyBoolean = (PyBoolean) value;
- 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 equals
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof SuspendedExecution)) return 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 init
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
@PostConstruct
public void init() {
//We use dedicated JDBCTemplates for each query since JDBCTemplate is state-full object and we have different settings for each query.
pollJdbcTemplate = new StatementAwareJdbcTemplateWrapper(dataSource, "pollJdbcTemplate");
pollForRecoveryJdbcTemplate = new StatementAwareJdbcTemplateWrapper(dataSource, "pollForRecoveryJdbcTemplate");
- 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 findPauseReason
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private PauseReason findPauseReason(Long executionId, String branchId) {
// 1. Check the configuration according to branch (can be null or not null...)
if (workerConfigurationService.isExecutionPaused(executionId, branchId)) {
ExecutionSummary execSummary = pauseService.readPausedExecution(executionId, branchId);
if (execSummary != null && execSummary.getStatus().equals(ExecutionStatus.PENDING_PAUSE)) {
- 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 monitor
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
@Transactional
public void monitor() {
if (!parseBoolean(getProperty("score.poll.use.large.message.query", "true"))) {
return;
Method pauseExecution
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private Long pauseExecution(Execution execution, PauseReason pauseReason, boolean updateParentExecObject) {
String branchId = execution.getSystemContext().getBranchId();
// When flow termination type is canceled, it should not pause
if ((execution.getSystemContext().getFlowTerminationType() != null) &&
Method joinMiBranchesAndSendToQueue
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private int joinMiBranchesAndSendToQueue(List<SuspendedExecution> suspendedExecutions) {
List<ExecutionMessage> messages = new ArrayList<>();
List<SuspendedExecution> mergedSuspendedExecutions = new ArrayList<>();
if (logger.isDebugEnabled()) {
Method workerKeepAlive
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressWarnings("unused")
// Scheduled in xml
public void workerKeepAlive() {
if (!recoveryManager.isInRecovery()) {
if (endOfInit) {