IDE: Using sonarlint-plugin-api and sonarlint-core in a custom project for Gerrit.
In my company, we have an app that retrieves all modified files in a Gerrit change and runs SonarLint on them to provide comments for each rule violation detected.
Recently, we decided to upgrade our versions of sonarlint-plugin-api and sonarlint-core from 7.0.0.37656 to 9.8.0.76914. Since this upgrade, some rule violations are no longer triggered, even though they appear on SonarQube.
When investigating this issue, I found this ticket: SONARJAVA-3777.
As I understand it, we now need to compile the code before analysis for certain checks to be triggered.
To test this, I checked the UselessImportCheckTest both before and after applying the changes mentioned in the ticket.
There are four different flavors of SonarLint, corresponding to four different IDEs, and they have different versions, so I was asking for both flavor and version to verify that you’re using the latest implementation of the rule.
But looking more closely at your initial post (like maybe I should have done to start with )…
You’re using the tools in a way that was never intended. SonarQube for IDE (nee SonarLint) was intended to run in the IDE, as the developer codes. It was never intended to be run as part of a job. That’s what SonarQube Server / Cloud / Community Build is for.
SonarQube for IDE (nee SonarLint) was intended to run in the IDE, as the developer codes. It was never intended to be run as part of a job. That’s what SonarQube Server / Cloud / Community Build is for.
So my code is currently retrieving the rules from a SonarQube, and execute it with sonarLint.
If I cannot use sonnarLint to do the job, is there a way to ask dynamicaly SonarQube Server to analyze a single file without storing the result into SonarQube Server (via an HTTP request or something else) ?
Would you mind explaining why you want to do it this way?
In the company I’m working, we’re currently using gerrit to review commits made by developers.
To see if a change is valid, we run a jenkins job that :
Compile the projet
Run tests
Get all modify file to run sonar on it (with our plugin).
Our sonar plugin gives a note to know if there is new sonar issue on the change (or old ones) and make comments using sonar rule information (exemple in the following capture) :
I will definitely have a look at it, to see how it can fit with gerrit. I see you have github, and gitlab integration, but no turnkey solution for gerrit.