SonarQube marks function refered by MethodSource as Unused "private" method per rule 1144

Hi @irina.batinic ,

Thanks for the update.

Out of curiosity, was this communicated in any changelog?

Also, is the analysis scope of a given rule configurable in SonarCloud?

Regarding @MethodSource, there’s a false positive when no value is passed to the annotation:

If no factory method names are declared, a method within the test class that has the same name as the test method will be used as the factory method by default.

Source: https://junit.org/junit5/docs/5.8.0/api/org.junit.jupiter.params/org/junit/jupiter/params/provider/MethodSource.html

As JUnit5 is a massively used library, is there any chance that this false positive could be fixed? Most of our uses of @MethodSource rely on this default behavior.

1 Like