Hi,
Currently I’m trying to make SonarQube able to integrate more seamlessly with Magento (2). An example of something I’m trying to resolve is a false-positive “UnusedFunctionParametersCheck” issue in case of a Magento plugin.
Our Use-Case
A plugin in Magento is a method with before
, after
or around
as its prefix and after that the method name to “intercept”, for example, a method execute
could have a plugin beforeExecute
, afterExecute
and aroundExecute
.
In case of the mentioned types of plugins the first argument is always the “subject”, the class where the execute
method is declared. $subject
is not always used, but because SonarQube doesn’t know about plugins in Magento and how they work it will create a false-positive issue to remove the “unused method parameter”.
Question
I want to extend the original “UnusedFunctionParametersCheck” to accommodate the above mentioned use-case.
I seem to have 2 options but I’d like there to be a third because I really don’t like the two I came up with.
- Fork the “sonar-php” repository and make my changes in there, this doesn’t really seem right because the “sonar-php” repository should target PHP and not a specific framework (use-case).
- Copy-paste the original “UnusedFunctionParametersCheck” and disable the one in the “sonar-php” plugin.
Is there a way for me to possibly remove issues that another rule added, so that I keep the original “UnusedFunctionParametersCheck” but afterwards I run my own rule which might or might not remove issues created by the “UnusedFunctionParametersCheck”?