Hi, I have configured sonarqube server and analyzed my .net project. I have some piece of code which doesn’t have any reference (unused code) but I couldn’t see those as Code smell or Bug or Vulnerable.
Does sonarCube performs checks for unused code? or I missed some configuration?
Hi,
depending on the analyzer plugins you’ve installed in your Sonarqube instance you should see a lot of rules for Unused code, Dead stores … etc. see https://yoursonarhost/coding_rules?q=Unused
Regards,
Gilbert
HI,
I’m using Csharp plugin . But I’m pretty much sure that sonarqube does the check for unused code.The above link you shared is not accessible for me.
Thanks.
Hi,
of course you need to adjust the URL for your instance. Replace yoursonarhost with the name of your instance or instance:port if you don’t use port 80.
Regards,
Gilbert
Hi,
if you use the filter for C# analyzer = https://yoursonarhost/coding_rules?languages=cs&q=Unused
my instance with the latest C# analyzer 7.9 (build 7583) installed shows 6 rules.
All of them are included in the default Quality Profile “Sonar way” that ships with the C# analyzer.
Gilbert
OK, maybe you need to adjust the file suffix , see https://yoursonarhost/admin/settings?category=c%23 !?
The default setting is .cs
If you didn’t set a specific Quality Profile, the C# Sonar Way will be used.
And if your exclusion setting is empty - means no files excluded - there should be issues if unused code is detected, see rule description for examples and do a small test with those snippets.
Gilbert