For the classical static code analysis you could use predefined Microsoft rule sets like Managed Recommended Rules.
Is there an easy way to configure FxCopAnalyzers to only apply rules that are within a certain rule set? The workflow we are currently using is the following:
This is somehow tedious, so I wonder if there is a better way to do this?
This is one of the primary tasks that we need to do prior to releasing 1.2.0 bits of this package. Currently, there is no non-trivial way to do this.
FYI @srivatsn
Do we have rulset support in version 2.0?
@jinujoseph There have been multiple requests for this now. I will spend some time on this tomorrow to see if I can come up with a quick solution so our cibuild also generates:
I think we need this for a good compat story anyways.
+1
+1
I have a PR out to package classical and auxiliary rulesets along with each analyzer package: https://github.com/dotnet/roslyn-analyzers/pull/1718
Kindly, take a look at the description and screenshots in the PR to confirm this satisfies everyone's ask.
@Dresel @axelheer @alextolp @curia-damiano
Published on NuGet: https://www.nuget.org/packages/Microsoft.CodeAnalysis.FxCopAnalyzers/2.6.2-beta1
Also tagging @gewarren. We probably want to document https://github.com/dotnet/roslyn-analyzers/pull/1718#issue-194133287 and https://github.com/dotnet/roslyn-analyzers/pull/1718#issuecomment-396423976 on docs.microsoft.com, so customers who wants to migrate from legacy FxCop to FxCop analyzers without altering their existing rule configuration can use the new rulesets that we package with the analyzer packages.
@mavasani will do, thanks.
Looks good. Thanks 馃憤
Can you please describe how those rulesets can be used in a project? I tried adding <CodeAnalysisRuleSet>..\rulesets\legacy\MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> with different paths and ended with just copying the ruleset folder to my project.
@zivillian Relative paths will not work as the ruleset location is relative to the NuGet package root. You either need to explicitly define/reference NuGet package root and package version in your absolute path OR copy over the required ruleset files to your project directory.
Most helpful comment
Do we have rulset support in version 2.0?