Method getOutputTable
has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring. Open
@Override
public BufferedDataTable getOutputTable(String assignments,
ExecutionContext exec) throws CanceledExecutionException,
ConvertException {
BufferedDataContainer buf = exec.createDataContainer(SchemaFactory
- 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
File SecondaryJoiner.java
has 550 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*******************************************************************************
* Copyright (c) 2015 Federal Institute for Risk Assessment (BfR), Germany
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- Create a ticketCreate a ticket
Method getOutputTable
has 151 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public BufferedDataTable getOutputTable(String assignments,
ExecutionContext exec) throws CanceledExecutionException,
ConvertException {
BufferedDataContainer buf = exec.createDataContainer(SchemaFactory
- Create a ticketCreate a ticket
Method checkIfInputIsValid
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
private void checkIfInputIsValid() {
Map<String, JComboBox<String>> depVarBoxes = new LinkedHashMap<>();
isValid = true;
for (String model : comboBoxes.keySet()) {
- 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 createPanel
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public JComponent createPanel(String assignments) {
JPanel panel = new JPanel();
JPanel topPanel = new JPanel();
- Create a ticketCreate a ticket
Method addOrRemoveButtonPressed
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void addOrRemoveButtonPressed(JButton button) {
for (String model : addButtons.keySet()) {
List<JButton> modelAddButtons = addButtons.get(model);
List<JButton> modelRemoveButtons = removeButtons.get(model);
List<Map<String, JComboBox<String>>> modelBoxes = comboBoxes
- Create a ticketCreate a ticket
Method checkIfInputIsValid
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void checkIfInputIsValid() {
Map<String, JComboBox<String>> depVarBoxes = new LinkedHashMap<>();
isValid = true;
for (String model : comboBoxes.keySet()) {
- Create a ticketCreate a ticket
Method readModelTable
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void readModelTable() {
models = new ArrayList<>();
modelNames = new LinkedHashMap<>();
modelFormulas = new LinkedHashMap<>();
dependentVariables = new LinkedHashMap<>();
- Create a ticketCreate a ticket
Method readDataTable
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void readDataTable() {
dependentParameters = new LinkedHashMap<>();
primaryModelNames = new LinkedHashMap<>();
independentParameterCategories = new LinkedHashMap<>();
- Create a ticketCreate a ticket
Method readDataTable
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private void readDataTable() {
dependentParameters = new LinkedHashMap<>();
primaryModelNames = new LinkedHashMap<>();
independentParameterCategories = new LinkedHashMap<>();
- 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
Avoid deeply nested control flow statements. Open
if (primaryModelNames.get(id).equals(modelName)) {
modelID = id;
break;
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (!CellIO.getNameList(params).contains(
newDepVarSecName)) {
continue;
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
for (PmmXmlElementConvertable el : miscs
.getElementSet()) {
MiscXml element = (MiscXml) el;
if (paramsConvertTo.containsKey(element.name)) {
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (!replace.containsKey(iv.name)) {
error = true;
break;
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (!globalIds.containsKey(id)) {
globalIds.put(id,
MathUtilities.getRandomNegativeInt());
}
- Create a ticketCreate a ticket
Method createPanel
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@Override
public JComponent createPanel(String assignments) {
JPanel panel = new JPanel();
JPanel topPanel = new JPanel();
- 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
Avoid deeply nested control flow statements. Open
if (id != modelID) {
continue;
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (!tuplesByPrimID.containsKey(modelXml.id)) {
tuplesByPrimID.put(modelXml.id,
new ArrayList<KnimeTuple>());
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
for (String var : oldIndepVars) {
String unit = independentVariableUnits.get(model)
.get(var);
String newVar = replace.get(var);
- Create a ticketCreate a ticket
Method addOrRemoveButtonPressed
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private void addOrRemoveButtonPressed(JButton button) {
for (String model : addButtons.keySet()) {
List<JButton> modelAddButtons = addButtons.get(model);
List<JButton> modelRemoveButtons = removeButtons.get(model);
List<Map<String, JComboBox<String>>> modelBoxes = comboBoxes
- 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 getAssignments
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public String getAssignments() {
Map<String, List<Map<String, String>>> assignmentsMap = new LinkedHashMap<>();
for (String model : comboBoxes.keySet()) {
- 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
Refactor this method to reduce its Cognitive Complexity from 92 to the 15 allowed. Open
public BufferedDataTable getOutputTable(String assignments,
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain.
See
Refactor this method to reduce its Cognitive Complexity from 33 to the 15 allowed. Open
private void checkIfInputIsValid() {
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain.
See
Identical blocks of code found in 4 locations. Consider refactoring. Open
for (PmmXmlElementConvertable el : indepVarsSec
.getElementSet()) {
IndepXml iv = (IndepXml) el;
if (!replace.containsKey(iv.name)) {
- 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 104.
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
if (box.getSelectedItem() == null) {
isValid = false;
} else {
JComboBox<String> sameValueBox = indepVarBoxes.get(box
.getSelectedItem());
- 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 100.
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
if (box.getSelectedItem() == null) {
isValid = false;
} else {
JComboBox<String> sameValueBox = depVarBoxes.get(box
.getSelectedItem());
- 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 100.
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
for (KnimeTuple dataTuple : dataTuples) {
CatalogModelXml modelXml = (CatalogModelXml) dataTuple
.getPmmXml(Model1Schema.ATT_MODELCATALOG)
.get(0);
- 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 70.
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
private List<String> getIndepParamsFromCategory(String category) {
List<String> params = new ArrayList<>();
for (String param : independentParameterCategories.keySet()) {
if (category == null
- 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 58.
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 5 locations. Consider refactoring. Open
for (PmmXmlElementConvertable el : row.getPmmXml(
Model2Schema.ATT_INDEPENDENT).getElementSet()) {
IndepXml element = (IndepXml) el;
indepCategories.put(element.name, element.category);
- 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 56.
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