Showing 111 of 111 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
function startNodesPerSecondChart()
{
log.debug('Starting nodes per second chart...');
var canvasElement = document.getElementById('nodesPerSecondChart');
- 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 416.
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
function startBytesPerSecondChart()
{
log.debug('Starting bytes per second chart...');
var canvasElement = document.getElementById('bytesPerSecondChart');
- 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 416.
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 loadMetadata
has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring. Open
@Override
public final Metadata loadMetadata(final File metadataFile)
{
Metadata result = new Metadata();
- 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 scanDirectory
has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring. Open
private void scanDirectory(final BulkImportSourceStatus status,
final BulkImportCallback callback,
final File sourceDirectory,
final File directory,
final boolean submitFiles)
- 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
BulkImportStatusImpl
has 60 methods (exceeds 20 allowed). Consider refactoring. Open
public class BulkImportStatusImpl
implements WritableBulkImportStatus
{
// General information
private AtomicBoolean inProgress = new AtomicBoolean(false);
Method importVersionMetadata
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
private final void importVersionMetadata(final NodeRef nodeRef,
final BulkImportItemVersion version,
final boolean dryRun)
throws InterruptedException
{
- 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 BatchImporterImpl.java
has 494 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright (C) 2007 Peter Monks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Method toString
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
@Override
public String toString()
{
final StringBuilder result = new StringBuilder(1024);
final Collection<Model> dataDictionary = getDataDictionary();
- 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 importVersionContent
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
private final void importVersionContent(final NodeRef nodeRef,
final BulkImportItemVersion version,
final boolean dryRun)
throws InterruptedException
{
- 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
BulkImportStatus
has 41 methods (exceeds 20 allowed). Consider refactoring. Open
public interface BulkImportStatus
{
// Target counters
public final static String TARGET_COUNTER_BATCHES_SUBMITTED = "Batches submitted";
public final static String TARGET_COUNTER_BATCHES_COMPLETE = "Batches completed";
Method classDefinitionToString
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
private String classDefinitionToString(final ClassDefinition definition)
{
StringBuilder result = null;
if (definition != 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 loadMetadataIfNecessary
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
private final synchronized void loadMetadataIfNecessary()
{
if (cachedMetadata == null)
{
cachedMetadata = metadataLoader.loadMetadata(metadataReference);
- 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 run
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void run()
{
boolean inPlacePossible = 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
File bulkimport.js
has 354 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright (C) 2012 Peter Monks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Method findOrCreateNode
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
private final NodeRef findOrCreateNode(final NodeRef target,
final BulkImportItem<BulkImportItemVersion> item,
final boolean replaceExisting,
final boolean dryRun)
{
- 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 Scanner.java
has 330 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright (C) 2007 Peter Monks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Method importComplete
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
@Override
public final void importComplete(BulkImportStatus importStatus)
{
if (info(log))
{
- 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 BulkImportStatusImpl.java
has 328 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright (C) 2007 Peter Monks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Function refreshTextElements
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
function refreshTextElements(cd)
{
log.debug('Refreshing text elements...');
if (cd != 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
LogUtils
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
public final class LogUtils
{
private final static String IDENTIFIER = "BULKIMPORT";
private final static String PREFIX = IDENTIFIER + ": ";
private final static String RAW_EXCEPTION = IDENTIFIER + " threw: ";