Hi,
The easiest way, which doesn’t involve writing a plugin for SonarQube, is to import “external issues” in SonarQube.
Here is some documentation about it: https://docs.sonarqube.org/7.4/analysis/generic-issue/
Note that this strategy has some limitations, has described in the docs. It’s easy to try - you just need to modify the data to a json file.
I could live with the limitations of this import. But i don’t see any documentation for the actual import process or did i miss that ? is there an API which accepts the data format specified? If i run the linter for multiple projects, multiple times a day i really don’t want to perform the import manually or edit the list of reports for the analysis parameter each time.
Also, i am not hesitant of writing a Sonar Plugin, i just don’t want to rewrite each linting rule again. That being said, is there a way to write some kind of sonar plugin which could just expect an issue set instead of executing the rules within sonar, any pointers to related documentation or open source efforts would be very appreciated
You should feel free to pass your report to the sonar.externalIssuesReportPaths analysis parameter when performing a scan of your code. That’s how the data gets imported.
A scan is ultimately required to import issue data into SonarQube.
Thanks a lot, wow you are guys are awesome and fast.
Let me try this out.
BTW, for my curiosity, are there any other options for integration when i use an external linter , i am willing to pursue that road if it gives me a deeper integration with SonarQube.
The only other option is to write a new analyzer for SonarQube. The analyzer would need to interact with the Sonar API to declare rules and create issues found with those rules.
It could be interesting if you were supporting a new language that is not supported by one of the SonarSource’s analyzers, since you could not only create issues but also highlight code and create symbols for that language, create measures, etc. If your goal is only to import issues, it’s probably overkill.