I believe that list of exceptions in Sonar rule java:S107 should be extended, so that the limit of parameters is not applied to methods with the following Micronaut annotations from io.micronaut.http.annotation
package:
@ Get, Head, Post, Put, Delete, Options, Trace, Patch
Justification:
Java REST frameworks allow to map a HTTP request to a controller method, that handles the request.
The HTTP request may contain many parameters (in URL, in body, in HTTP headers) and they are all passed to the controller method.
This way, controller methods may violate the java:S107.
Fortunately, the Sonar rule contains exception for methods annotated with Spring’s @RequestMapping
.
However, the Sonar rule contains no exceptions for Micronaut framework which has similar purpose.
Similar issue here as well: java:S107 misses some spring cases The same situation would be with Micronaut and its Bean lifecycle annotations.
Btw. perhaps the rule should be made configurable, so that anyone can add such annotations as exceptions? Would be easier to handle plenty of frameworks that are providing custom annotations alongside standard jakarta.
Affected version: 8.9.x+