Issues detected by custom plugin not displaying in Sonarqube

I am developing a Custom Sonar Plugin. It is successfully identifying issues in XSLT code but the issues are not showing up in SonarQube.

Here is some background:

  1. The custom plugin was built by cloning and refactoring the https://github.com/SonarSource/sonar-custom-plugin-example.
  2. Custom rules are being generated and activated, and are being displayed in SonarQube.
  3. I examined a similar issue in the community (Custom plugin java rules don't detect any bugs) but it appeared to be Java-specific, specifically regarding CheckRegister. Is that right?

I derived the issue-reporting code from the example plugin (FooLintIssuesLoaderSensor). I have a PendingIssue class that is analagous to (FooLintIssuesLoaderSensor.ErrorDataFromExternalLinter). Here is an excerpt of my code:

NewIssueLocation newLocation = new DefaultIssueLocation()
		.on(inputFile)
		.message(pendingIssue.getMessage())
		.at(inputFile.selectLine(lineNumber));
RuleKey ruleKey = pendingIssue.rule(this.repoKey);
NewIssue newIssue = context.newIssue()
		.forRule(ruleKey)
		.at(newLocation);
		newIssue.save();

Any suggestions are greatly appreciated!

P.S. I’m running SonarQube 8.0 locally.

Well, no sooner than I post this question, I now see the issues displayed in SonarQube.
I recall reading somewhere that there could be a short delay updating SonarQube.
But this well could have been a PEBKAC problem ( (:slight_smile: ) where I didn’t correctly observe the UI.

1 Like