I am developing a custom rule in Java, but during the SonarQube analysis, the issue is not being flagged, even though it is correctly detected by SonarLint.
I have provided a detailed explanation of the issue here: ISSUES.md
Nope – it’s just a niche topic that not too many people are equipped to answer. So it takes some time. Feel free to contribute back to this community and free up somebody’s time!
This is an open community with people volunteering their free time to provide assistance. We’re eager to contribute to the community, but you are not guaranteed a fast response.
You need to check at first all setttings of your analyis, i.e.
use loglevel DEBUG to see all details for the analysis
is the file included for the scan ?
is your custom rule really part of the quality profile ?
… etc.
I don’t want to analyze your implementation in detail, but I have created a bunch of
custom rules over the years and can give you the following advice:
Creating your own rule should always be the last option, because creating custom rules
is tricky and causes maintenance overhead
You may also be able to use a rule template, see https://<yoursonarhost>/coding_rules?is_template=true&languages=java&open=java%3AS3688
Remember that you will have to adapt custom rules in the future
I started with Sonarqube 5 and had to adapt my rules again and again due to API changes
(we use the latest version of Sonarqube Enterprise)