- Operating system: Windos10
- Visual Studio version: 2022 17.7.6
- SonarLint plugin version: 184.108.40.206872
- Programming language you’re coding in: C#
- Is connected mode used: false
- Connected to SonarCloud or SonarQube (and which version): none
And a thorough description of the problem / question:
Hello! I need to be able to see all the instances in which the rule S1244 is triggered.
I cannot find help online for C# and i tried all the possible configurations in the settings.json:
Thank you very much in advance!
Welcome to the Sonar community!
I am not sure what you mean by “see all the instances in which the rule S1244 is triggered”.
Can you elaborate on what your problem is exactly?
Hi Denis, thank you for your reply!
what i mean is that i would like to see the rule/error shown in VisualStudio as it happens for other rules:
to be able to fix the issue, i need to be able to locate the places, in the code, where the issue happens.
So if I understand you correctly, you are wondering why, in SonarLint standalone mode, you do not see S1244 being raised while you do see other errors, am I right?
If that is the case, it is probably because S1244 is not activated by default.
You can activate it
- using a ruleset (legacy option, the only one available for VS pre-2019)
- using a .EditorConfig file (available in VS 2019 and later)
For the EditorConfig, you can create such a file from VS using the menu on your project (if you do not already have one), and you can add the following inside:
dotnet_diagnostic.S1244.severity = error
That file can be added to the repo to share the rules amongst contributors if you are not using connected mode.
You can refer to the SonarLint documentation for more information about that.
I hope this actually answers your question. If it does not, please feel free to correct me and I’ll try to help.
Thank you for your reply!
But is there a way to add this configuration in VisualStudio?
We have hundreds of projects in our solution…
You can simply add one file at the root of the repo (next to the solution) and it will be picked up by VS for all projects.
If you want specific settings on top of those per-project, you can simply add an editorconfig file in the project and set only the flags you need and they will overwrite the ones from the top-level file.
As far as I can see, you should specify root = true in the top-level file.
That should do the trick.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.