How to raise issue on main class


Sonarqube v7.7

When raising the issue, I want to raise on a specific class. Could you please tell me how to raise issue on Specific/Main class.

I tried using context.reportIssue() but it is flagging the issue on the last file scanned at the end of the package.



Please follow this community forum rules, and share all the context which will allow us to help you, as explicitly expressed in: About the Writing rules category

Concretely, please share:

  • the version of SonarJava your custom rules is based on
  • the code of your rule (without company-related info)
  • a reproducer illustrating your issue
  • an example of what you expect

If not complying to this, I’ll lock this thread.

Finally, note that SonarQube 7.7 is not supported anymore. Latest LTS version of SQ is 7.9.