Showing 14,752 of 14,752 total issues
Method getCachedTable
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private ResultSet getCachedTable(String cacheTable, String selectSQL, String whereSQL, String cacheWhereSQL, String[] relevantTables) throws SQLException {
boolean dropCacheFirst = false;
long lastCaching = DBKernel.getLastCache(conn, cacheTable);
//System.err.println(selectSQL + whereSQL);
//long ttt = System.currentTimeMillis();
- Read upRead up
- Create a ticketCreate a ticket
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 execute
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected PortObject[] execute(final PortObject[] inData, final ExecutionContext exec)
throws Exception {
FskPortObject portObject = (FskPortObject) inData[0];
- Read upRead up
- Create a ticketCreate a ticket
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 writeFSKObject
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static void writeFSKObject(FskPortObject fskObj, CombineArchive archive, String filePrefix,
Map<String, URI> URIS) throws Exception {
addVersion(archive);
- Read upRead up
- Create a ticketCreate a ticket
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 resolveParameterNamesConflict
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public void resolveParameterNamesConflict(FskPortObject fskPort1, FskPortObject fskPort2) {
for (Parameter firstParam : SwaggerUtil.getParameter(fskPort1.modelMetadata)) {
for (Parameter secondParam : SwaggerUtil.getParameter(fskPort2.modelMetadata)) {
if (secondParam.getId().equals(firstParam.getId())) {
firstParam.setName(firstParam.getId() + suffix);
- Read upRead up
- Create a ticketCreate a ticket
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 readEObjectList
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
private <T> List<T> readEObjectList(PortObjectZipInputStream zipStream, Class<T> valueType)
throws IOException, InvalidSettingsException {
List<JoinRelation> joinerRelation = new ArrayList<>();
String jsonStr = IOUtils.toString(zipStream, "UTF-8");
- Read upRead up
- Create a ticketCreate a ticket
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 saveSettingsTo
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) {
m_repositoryLocationSettings.saveSettingsTo(settings);
m_SandwichListSettings.saveSettingsTo(settings);
m_TitleSettings.saveSettingsTo(settings);
- Read upRead up
- Create a ticketCreate a ticket
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 writeFSKObject
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static void writeFSKObject(FskPortObject fskObj, CombineArchive archive, String filePrefix,
Map<String, URI> URIS, ScriptHandler scriptHandler) throws Exception {
addVersion(archive);
- Read upRead up
- Create a ticketCreate a ticket
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 adaptRelationNames
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private static void adaptRelationNames(CombinedFskPortObject portObject, String suffix, int suffixInsertionIndex,
Map<String, String> old_new_pramsMap) {
Map<String, String> mapInversed = old_new_pramsMap.entrySet().stream()
.collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey,
// choose the second value in the case of key duplication
- Read upRead up
- Create a ticketCreate a ticket
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 saveOutputParameters
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void saveOutputParameters(FskPortObject fskObj, Path workingDirectory)
throws VariableNotGlobalException, IOException {
StringBuilder script = new StringBuilder();
- Read upRead up
- Create a ticketCreate a ticket
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 saveInputParameters
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void saveInputParameters(FskPortObject fskObj, Path workingDirectory) throws Exception {
String path = workingDirectory.toString() + File.separator + JSON_FILE_NAME;
parameterJson = new ParameterJson(new File(path));
String modelId = SwaggerUtil.getModelId(fskObj.modelMetadata);
- Read upRead up
- Create a ticketCreate a ticket
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 saveOutputParameters
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void saveOutputParameters(FskPortObject fskObj, Path workingDirectory)
throws VariableNotGlobalException, IOException, ParameterJsonConversionException,
URISyntaxException {
// create script to store variables in hdf5 file
- Read upRead up
- Create a ticketCreate a ticket
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 addModificationDate
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static void addModificationDate(Model modelMetadata) {
Date dateJavaFormat = new Date();
LocalDate dateThreeTenFormat = Instant.ofEpochMilli(dateJavaFormat.getTime()).atZone(ZoneId.systemDefault()).toLocalDate();
String modelType = modelMetadata.getModelType();
if(modelType.equalsIgnoreCase( "genericModel")) {
- Read upRead up
- Create a ticketCreate a ticket
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 getAllChoices
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public List<Map<String, Integer>> getAllChoices() {
List<Map<String, Integer>> choices = new ArrayList<>();
List<String> argList = new ArrayList<>(functionArguments.keySet());
List<Integer> choice = new ArrayList<>(Collections.nCopies(
argList.size(), 0));
- Read upRead up
- Create a ticketCreate a ticket
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 saveChartAs
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static void saveChartAs(JFreeChart chart, String fileName,
int width, int height) {
if (fileName.toLowerCase().endsWith(".png")) {
try {
org.jfree.chart.ChartUtilities.writeChartAsPNG(
- Read upRead up
- Create a ticketCreate a ticket
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 modelNameEnabled
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private boolean modelNameEnabled(final String name) {
for (JCheckBox box : modelBoxSetPrim.values()) {
if (box.getText().equals(name)) return true;
if (box.getText().startsWith(name) && box.getText().lastIndexOf(" (") == name.length()) return true;
}
- Read upRead up
- Create a ticketCreate a ticket
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 conforms
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public boolean conforms( KnimeSchema other ) {
int i, j;
boolean found;
- Read upRead up
- Create a ticketCreate a ticket
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 findPackagedR
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private static void findPackagedR() {
if (!Platform.OS_WIN32.equals(Platform.getOS()))
return;
- Read upRead up
- Create a ticketCreate a ticket
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 initR
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private void initR() throws RException {
try {
String rHome = PreferenceInitializer.getR3Provider().getRHome();
// FIXME: Workaround for Linux server in BfR. If R home is not configure then
- Read upRead up
- Create a ticketCreate a ticket
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
public static ScriptHandler createHandler(String script_type, List<String> packages)
throws Exception {
final ScriptHandler handler;
- Read upRead up
- Create a ticketCreate a ticket
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 95.
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
package de.bund.bfr.knime.fsklab.nodes.environment;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Optional;
- Read upRead up
- Create a ticketCreate a ticket
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 95.
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