Is there any way to tell some analyzer that it should run only for open documents (regardless of "Full solution analysis" settings)?
Here's our setup:
We have some big C# solutions (100+ projects).
We use IDE, 3rd and custom Roslyn analyzers.
Primarily we have configuration of analyzers in ruleset file which is common to all projects.
When we use analyzer its severity is usually set to Warning.
We have "Full solution analysis" enabled.
The reason for this is we want to know about all warning during the development.
That means all enabled analyzer diagnostics must be fixed because we do not want any warnings in our solutions.
When we enable new analyzer:
We set its severity to "Info"/"Message".
There is typically hundreds to thousands occurrences so it takes a while to fix (not all diagnostics can be fixed automatically).
When someone wants to fix some occurrences he enables "Messages" in Error List window.
We have "Messages" in Error List window usually turned of because it contains large number of currently unfixed diagnostics.
Analyzers in our projects run only in "IntelliSense session" and not while standard building.
We remove Analyzer elements from projects files depending on 'BuildingInsideVisualStudio' and 'DesignTimeBuild' MsBuild properties.
This is just optimization of build times.
Not ideal but works and builds are 3x faster (which saves A LOT of time).
On build servers this optimization is disabled so they correctly report all errors/warnings.
Rationale why we would appreciate this feature:
Because of "Full solution analysis" enabled we can use only analyzers which diagnostics we are able (or which we want) to fix globally.
When we would enable analyzers which we would like to fix only somewhere we would be totally overwhelmed by all diagnostics (and VS too - its slow when its reporting a lot of diagnostics).
Disabling diagnostics by pragmas at all places we don't care about is not an option. Code would be totally cluttered by them.
If there would be some option to tell analyzer (ideally in ruleset file) that it is enabled but it should behave like "Full solution analysis" is disabled it would allow us to use much more analyzers because they would generate diagnostics only in currently open files.
What do you think about it? Or is there any completely different approach to handle analyzers that would solve our problems? The main thing is that we want some analyzers to be enforced and want to know about its diagnostics before putting our changes to version control system.
Is there any way to tell some analyzer that it should run only for open documents (regardless of "Full solution analysis" settings)?
Here's our setup:
Rationale why we would appreciate this feature:
What do you think about it? Or is there any completely different approach to handle analyzers that would solve our problems? The main thing is that we want some analyzers to be enforced and want to know about its diagnostics before putting our changes to version control system.
Thanks for the answers!