src/main/java/com/github/writethemfirst/approvals/utils/FunctionUtils.java
Method applyCombinations
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
Open
public static <IN1, IN2, IN3, IN4, IN5> String applyCombinations
(final Iterable<IN1> args1, final Iterable<IN2> args2, final Iterable<IN3> args3, final Iterable<IN4> args4,
final Iterable<IN5> args5, final Function5<IN1, IN2, IN3, IN4, IN5, ?> function) {
final StringBuilder results = new StringBuilder();
for (final IN1 arg1 : args1) {
- 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
Avoid deeply nested control flow statements. Open
Open
for (final IN5 arg5 : args5) {
try {
results.append(function.apply(arg1, arg2, arg3, arg4, arg5));
} catch (final Exception e) {
results.append(e);
Method applyCombinations
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
(final Iterable<IN1> args1, final Iterable<IN2> args2, final Iterable<IN3> args3, final Iterable<IN4> args4,
final Iterable<IN5> args5, final Function5<IN1, IN2, IN3, IN4, IN5, ?> function) {
Method applyCombinations
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
(final Iterable<IN1> args1, final Iterable<IN2> args2, final Iterable<IN3> args3, final Iterable<IN4> args4,
final Function4<IN1, IN2, IN3, IN4, ?> function) {