Stylecopanalyzers: Proposal: Have stylecop.json fully control StyleCop settings

Created on 7 May 2019  路  5Comments  路  Source: DotNetAnalyzers/StyleCopAnalyzers

Currently, only a fraction of StyleCop warnings/errors can be configured using stylecop.json. This is very frustrating when trying to create settings for the team.

Can we get stylecop.json to _fully_ cover each and every StyleCop rule?

Let me suggest an implementation detail that'd make fully covering StyleCop through stylecop.json easy: I don't believe we need dedicated texts in stylecop.json that differ from StyleCop warning/error numbers. They are syntactic sugar, but essentially it'd be sufficient to provide a JSON schema like this:

"StyleCopErrorNumber": "ignore|warning|error"

Providing named aliases for StyleCop error numbers would be alright, though:

{ "SA1101" : "ignore" }

// equivalent to:

{ "PrefixLocalCallsWithThis" : "ignore" }

This way you avoid any manual implementation for parsing the stylecop.json file. Instead, parsing the stylecop.json file would be a snap. Plus, using the stylecop.json as single source of truth would become comprehensive.

wontfix

Most helpful comment

Users will soon have the ability to control this via .editorconfig files (a compiler feature which will ship in an upcoming release).

All 5 comments

Users will soon have the ability to control this via .editorconfig files (a compiler feature which will ship in an upcoming release).

I'm just looking in to .editorconfig vs stylecop.json vs .ruleset files... Is this compiler feature now available? If so, any links that describe it?

@mavasani Do you have a link to the new documentation for using .editorconfig to control analyzer warnings?

Do you have a link to the new documentation for using .editorconfig to control analyzer warnings?

Tagging @gewarren. I think Genevieve has the documentation in review but not yet published.

Do you have a link to the new documentation for using .editorconfig to control analyzer warnings?

Tagging @gewarren. I think Genevieve has the documentation in review but not yet published.

Yes, that's correct. The documentation will be published on Monday on this page: https://docs.microsoft.com/en-us/visualstudio/code-quality/use-roslyn-analyzers?view=vs-2019

Was this page helpful?
0 / 5 - 0 ratings

Related issues

snowjim picture snowjim  路  6Comments

jeroenlandheer picture jeroenlandheer  路  3Comments

Onzi12 picture Onzi12  路  4Comments

mzhukovs picture mzhukovs  路  4Comments

batwad picture batwad  路  5Comments