Method getValue
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private JsonNode getValue(JsonNode jsonElement, String aKey) throws Exception {
//non JSON array object
if (!aKey.matches(".*" + ESCAPED_SLASH + "[[0-9]+]$")) {
if (jsonElement.get(aKey) != 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 getObject
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private JsonNode getObject(JsonNode jsonObject, String key, int startIndex) throws Exception {
if (key.matches("([\"'])(?:(?=(\\\\?))\\2.)*?\\1"))
return getValue(jsonObject, key.trim().substring(1, key.length() - 1));
- 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 getValue
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
private JsonNode getValue(JsonNode jsonElement, String aKey) throws Exception {
//non JSON array object
if (!aKey.matches(".*" + ESCAPED_SLASH + "[[0-9]+]$")) {
if (jsonElement.get(aKey) != null) {
Method execute
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Action(name = "Get Value from Object",
outputs = {
@Output(OutputNames.RETURN_RESULT),
@Output(OutputNames.RETURN_CODE),
@Output(OutputNames.EXCEPTION)
Method getObject
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private JsonNode getObject(JsonNode jsonObject, String key, int startIndex) throws Exception {
if (key.matches("([\"'])(?:(?=(\\\\?))\\2.)*?\\1"))
return getValue(jsonObject, key.trim().substring(1, key.length() - 1));
Avoid too many return
statements within this method. Open
return populateResult(returnResult, valueFromObject.toString(), null);
Avoid too many return
statements within this method. Open
return getObject(newJsonObject, key, ++startIndex);
Avoid too many return
statements within this method. Open
return getValue(jsonObject, aKey);
Avoid too many return
statements within this method. Open
return populateResult(returnResult, valueFromObject.asText(), null);
Method execute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Action(name = "Get Value from Object",
outputs = {
@Output(OutputNames.RETURN_RESULT),
@Output(OutputNames.RETURN_CODE),
@Output(OutputNames.EXCEPTION)
- 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"