Operating system: Windows 10
SonarLint plugin version: 6.16.0.69538 (VS2019)
Programming language you’re coding in: C#
Is connected mode used: Yes
Connected to SonarCloud or SonarQube (and which version): SonarQube 8.9.1
Hi,
I’m trying to set up SonarLint in connected mode with our SonarQube server instance. I’ve connected it to a project that’s using a custom quality profile, and that quality profile includes rules with properties that are set to non-default values. E.g. csharpsquid:S134 has a max nest depth default of 3, and I have set it to 5. However, locally, the default value of 3 is being used.
Is it possible to set SonarLint up to respect the non-default values?
Connected Mode should be using any custom rule parameters defined on the server. SonarLint reads the Quality Profile from the server and generates two files from it, a ruleset file that specifies the rules to run and their severity, and a SonarLint.xml file that contains additional rule parameters. See this wiki page for more information.
Check that the SonarLint.xml file exists and contains the expected rule parameter for S134 (you might need to update the binding if you have changed the rule parameter recently).
Then check that your MSBuild project contains the expected AdditionalFiles setting pointing at the SonarLint.xml file.
Finally, it’s possible that VS is displaying cached analysis results. You can trigger re-analysis by opening the code file containing the expected issue and making an edit.
So I double checked and everything seems to be in order. SonarLint.xml exists, is pointed to inside the MSBuild project file and contains the correct max parameter set to 5. I tried reopening the solution, reloading the project and making changes to the file and still the warning seems to be using the default value of 3 (warning appearing on the 4th nested if and the message contains 3 not 5).
In case I had messed up my solution somehow I created a new solution with a single project and set it up again. but I have the exact same situation as above.
MSBuild project file:
SonarLint.xml:
Warning appearing incorrectly:
Not too sure what else to try or what other information might be useful to help diagnose. Any ideas? Thanks.