Hi,
We have a existing solution containing 50 projects, adding the StuleCopAnalyzers to just one of these projects genereates 145 000 warnings! It also drags down the build time alot. My first thought was to disable StryleCopAnalyzers per default and just show the intellisense but I can麓t find a way to do this?
Our nightly builds(done on team server) do not accept build warnings at all so we want to :
How do I implmenet StyleCopAnalyzers the best way in a solution like this? Or is StyleCopAnalyzes not the right tool in this case?
I'm curious if there are any recommendations for this as well. I was searching for a way to turn off background code analysis because of performance issues -- especially with ReSharper running -- but did not find a way. We have hundreds of thousands of violations because we've neglected to run the old StyleCop extension consistently. I guess that's the price we pay...
My first thought was to disable StryleCopAnalyzers per default and just show the intellisense but I can麓t find a way to do this?
The approach I've been using so far is to set most/all of the analyzer outputs to Info rather than Warning. The end result seems to be that the build process is faster because it doesn't contain so many warnings, but the user can still see the indicators within the VS editor when rules are violated. You can look at the _Error List_ window in VS to see violations in the files you've opened. Using the toggle for the _Messages_ severity allows you to show/hide these violations. If you don't want to hide messages from other sources, you can choose to filter the error list to _Build_ items instead of _Build + IntelliSense_ items.
You could also swap out the code analysis rulesets in different build configurations, e.g. debug could output rule violations as warnings whereas release (or whatever your build server uses) could disable the output.
Creating a custom rule set and setting everything to info is the only thing that I can think of as well.
And don't forget that you can use the code fixes to perform multiple fixes (on both project and solution level) in one go (link) . That may reduce the number of warnings significantly in a short time.
Having helped several projects adopt StyleCop Analyzers, my recommendation at this point would be the following:
@sharwell is there a way to use StyleCop code fixers in JetBrains Rider too?
@oniric85 I'm not familiar with that environment specifically. The code fixes are intended to work in any IDE that supports Roslyn's code fixes API.
Most helpful comment
Having helped several projects adopt StyleCop Analyzers, my recommendation at this point would be the following: