There’s an excellent tutorial on adding custom rules for Java here https://github.com/SonarSource/sonar-java/blob/126.96.36.19988/docs/CUSTOM_RULES_101.md, along with plugin templates at https://github.com/SonarSource/sonar-custom-rules-examples
I’d like to add some custom rules for Go, to supplant some other code analyzers I currently use and have everything integrated in SonarQube. I currently use the linter import feature for this, but that’s not nearly as good as having them as integrated rules (I can’t set priority and assign issued and add help text and so on if they just come from a linter import.)
The rules I want to add are fairly simple – they’re basically regex checks, so I can write them using the code for, e.g., slang/checks/HardcodedCredentialsCheck.java as a template.
However, since Go is now part of the Slang framework, I’m having trouble figuring out what all I need to do to get the check to actually run, but only for Go code. I’m amenable to either forking the slang plugin or writing my own separate plugin, but I can’t seem to locate any documentation equivalent to the “Registering the rule in the custom plugin” section of the Java documentation to make it run.
Is there any sample code or instructions on how to add a rule to the current slang-based sonar-go?