Issues not detected in VS2017

145 views
Skip to first unread message

soulf...@gmail.com

unread,
Feb 12, 2018, 3:29:35 PM2/12/18
to SonarLint

Hi,
I am in connected mode, and the connection is updated.

I copied non-compliant code to test if SonarLint will raise errors for different rules I spotted.


So I copied code from rules S1104, S1313 and S2068. As you can see in the errors window, the S2068 rule is not showing up even if it's listed in the ruleset. It is activated on the server and it matches my Quality Profile.

Can you help me finding what's wrong?


Also, I made a custom rule using Roslyn SDK. The rule is successfully raised on the server side, and the issue is supposed to be of severity "Critical".

The custom rule (which is only to test custom rules creation) is supposed to report if class name contains lower case letters. So it's not raising the error.


Thanks!








valeri....@sonarsource.com

unread,
Feb 13, 2018, 3:31:59 AM2/13/18
to SonarLint
Hi,

S2068 is a parametrized rule and as such is not executed in SonarLint. The rule runs only when your project is analyzed with Scanner for MSBuild and the results will be shown in SonarQube.

SonarLint also does not execute custom rules. To use custom rules in Visual Studio you will have to add a nuget reference to your analyzer and Visual Studio will pick it up automatically.

Kind regards,
Valeri


soulf...@gmail.com

unread,
Feb 13, 2018, 8:09:43 AM2/13/18
to SonarLint
Thank you for your answer. I didn't knew about this limitation on parametrized rules.

For the custom rules, they should be downloaded when I do an Upgrade from SonarQube connection, right?
For some reason, it's not happening. I don't have the nuget package in my solution.

valeri....@sonarsource.com

unread,
Feb 13, 2018, 8:25:53 AM2/13/18
to SonarLint
Hi Michael,

We will remove the limitation with the parametrized rules soon. A new major version of SonarLint is being developed that will change the way the rules are configured. The automatic parameter sync will come in an update after that.

SonarLint will add/update references only to SonarSource nugets from SonarC# and SonarVB. In order to show warnings in Visual Studio all other analyzers should be added manually, even those who are installed on SonarQube. For the time being we don't have plans to change this behavior.

Scanner for MSBuild, however, is able to successfully execute analyzers that have corresponding plugins on SonarQube. In other words, you don't need to add analyzer references if you just want to analyze in your CI builds.

Kind regards,
Valeri


valeri....@sonarsource.com

unread,
Feb 13, 2018, 8:43:31 AM2/13/18
to SonarLint
I just pasted your code in a new console application and I was able to see warnings even from S2063, it appears that it is not disabled by default in SonarLint even though it is parametrized... That's weird and is probably a bug on our side.



 
Reply all
Reply to author
Forward
0 new messages