I’m trying to set up SonarQube to have our coding conventions/rules in it. I’m looking for ideas on how to do this best. We’re using C# as our dev language and Visual Studio as our IDE.
We have dozens of projects that should all follow the same coding conventions.
Our tools:
- Language: C#
- IDE: Visual Studio
Our goals:
- Have all our code comply to our custom coding conventions/styling rules.
- We have dozens of projects. All projects should comply to these rules
- Rules should be configured in a centralized place so that all devs will automatically be using the same rules at all times.
- A bonus would be if we can automatically do all this in a centralized place. Maybe when pushing code to origin?
Any tips or ideas on how we can achieve our goals?
What I tried
As a test, I installed SonarLint and set it up in Connected Mode. This doesn’t seem to check all SonarQube rules. I found, after some searching, that SonarLint only checks for Sonars own rules. Not for 3rd party rules.
I’ve also looked for what I can use to ‘beautify’ our code by making it match or coding style rules. The suggestions I found mentioning Roslyn analyzers and editorconfigs.
From my understanding, usage of Roslyn analyzers would mean adding the analyzer dlls to each and every project, which I want to avoid.
And editorconfigs are stored locally which means, if we decide to change some rules, everyone would had to manually update their editorconfig files OR we would have to add editorconfig files to each project. Also at first glance, it looks like editorconfig files aren’t very flexible.