de.bund.bfr.knime.fsklab.nodes/src/de/bund/bfr/knime/fsklab/nodes/ParameterJson.java
Method getParameter
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
Open
public DataArray getParameter() {
try {
if (isOutputClosed) {
// open Json file stream if it isn't already open
if (isInputClosed) {
- 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 getParameter
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public DataArray getParameter() {
try {
if (isOutputClosed) {
// open Json file stream if it isn't already open
if (isInputClosed) {
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
Open
if (jsonParser.nextToken() == JsonToken.START_ARRAY) {
if (jsonParser.nextToken() != JsonToken.END_ARRAY) {
return getNextParameter(jsonParser);
- Create a ticketCreate a ticket
Method addParameter
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public void addParameter(Parameter parameter, String modelId, String data, String parameterType,
String language) {
- Create a ticketCreate a ticket
Refactor this method to reduce its Cognitive Complexity from 33 to the 15 allowed. Open
Open
public DataArray getParameter() {
- 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.