WriteThemFirst/approvals-java

View on GitHub

Showing 10 of 10 total issues

Method applyCombinations has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
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) {

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 verifyAllCombinations has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        final I1[] args1,
        final I2[] args2,
        final I3[] args3,
        final I4[] args4,
        final I5[] args5,
Severity: Minor
Found in src/main/java/com/github/writethemfirst/approvals/Approvals.java - About 45 mins to fix

    Avoid deeply nested control flow statements.
    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

          (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 verifyAllCombinations has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                final Iterable<I1> args1,
                final Iterable<I2> args2,
                final Iterable<I3> args3,
                final Iterable<I4> args4,
                final Iterable<I5> args5,
        Severity: Minor
        Found in src/main/java/com/github/writethemfirst/approvals/Approvals.java - About 45 mins to fix

          Method verifyAllCombinations has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  final I1[] args1,
                  final I2[] args2,
                  final I3[] args3,
                  final I4[] args4,
                  final Function4<I1, I2, I3, I4, ?> f) {
          Severity: Minor
          Found in src/main/java/com/github/writethemfirst/approvals/Approvals.java - About 35 mins to fix

            Method apply has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                OUT apply(final IN1 arg1, final IN2 arg2, final IN3 arg3, final IN4 arg4, final IN5 arg5);

              Method verifyAllCombinations has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      final Iterable<I1> args1,
                      final Iterable<I2> args2,
                      final Iterable<I3> args3,
                      final Iterable<I4> args4,
                      final Function4<I1, I2, I3, I4, ?> f) {
              Severity: Minor
              Found in src/main/java/com/github/writethemfirst/approvals/Approvals.java - About 35 mins to fix

                Method applyCombinations has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    (final Iterable<IN1> args1, final Iterable<IN2> args2, final Iterable<IN3> args3, final Iterable<IN4> args4,
                     final Function4<IN1, IN2, IN3, IN4, ?> function) {

                  Method read has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      static Optional<CommandReporter> read() {
                          if (isInCi()) {
                              return Optional.empty();
                          } else if (dotFile.toFile().exists()) {
                              try {

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language