I have a possible case where sonar is flagging a web api controller in error.
we use azure devops for repositories and builds.
the language is C# on dot net 8
i have a web api controller that has a method to use Odata / IQueryable on one method and that is beeing flagged for the SRP rule.
This controller has multiple responsibilities and could be split into 2 smaller controllers.
Controllers should not have mixed responsibilities csharpsquid:S6960
the controller has about 7 methods that all deal with the same entity.
if i remove the one get the sonar issue is gone.
but that means that i will then need a second controller to have one method for the same entity.
the controller is a standard api controller on ControllerBase
the method that triggers the message is like this:
[HttpGet]
[EnableQuery]
public IQueryable<WorItem> Get()
{
return ctx.WorkItems;
}
ctx is an efcore context.
the controller also has a repository service that uses the same ef model.
i am wondering if that might be the source of the problem.
or if the scan just does not understand the option to have the enable query / odata option ?