10

Can I disable / enable the set of rules that are shown by SonarLint for VS? How? A similar question was already asked in Is there some graphical way to create my own configuration file on SonarLint? but I wasn't able to follow the answer, i.e. did not find the Project/References/Analyzers node in the Solution Explorer, to be able to edit the active rule set file. Can you help me out on this one?

Community
  • 1
  • 1
the_jov
  • 185
  • 1
  • 2
  • 8

1 Answers1

9

Here is how to open the active rule set of a project:

How to open Active Rule Set from Solution Explorer in VS2015

From there, you'll be able to enable and disable rules:

Toogle rules in VS2015

The path to the rule set file to be used is saved within your .csproj file under the <CodeAnalysisRuleSet>...</CodeAnalysisRuleSet> tag. You can reference the same rule set file from multiple projects, and store the rule set along with your project sources in Git / TFVC if you'd like all developers to share the same rule set.

Dinesh Bolkensteyn
  • 2,971
  • 1
  • 17
  • 20
  • 3
    This is an essential feature of SonarLint, yet it is not mentioned in text anywhere on the SonarLint webpage. It would be good if there would be a "how to get started" on sonarlint.org/visualstudio, or even in the Github README.MD. – 2v0mjdrl Jan 11 '16 at 07:19
  • 3
    Agreed. I've never seen such a lack of useful information on any tool. Here's a tag . Dude that's wonderful, and I appreciate the time taken to answer. Follow up questions: 1. Does that tag need to be under some other tag? 2. What goes inside the tag? – jschank Jan 30 '16 at 20:19
  • 3
    How can I do this in IntelliJ Idea? – Eswara Reddy May 25 '17 at 09:44
  • 1
    @EswaraReddy were you able to find how to do it on IntelliJ IDEA? – Don Charlie Oct 16 '20 at 15:36
  • 1
    It looks like you can configure this in IntelliJ IDEA under Settings -> SonarLint – Zephyr Mar 28 '23 at 14:59
  • How to configure this per a project-specific, editor-agnostic config file? – Ingo Steinke Aug 07 '23 at 18:19