question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal: Have stylecop.json fully control StyleCop settings

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
sharwellcommented, May 7, 2019

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

1reaction
gewarrencommented, Sep 18, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

StyleCopAnalyzers/documentation/Configuration.md at ...
The easiest way to add a stylecop.json configuration file to a new project is using a code fix provided by the project. To...
Read more >
StyleCop Analyzers Implementation in .NET
In this article, we will explore StyleCop Analyzers and how to configure them to enforce the desired coding style across our team.
Read more >
How to Correctly Include stylecop.json Into Your Project
We use StyleCopAnalyzers (the successor of the StyleCop package) to get consistent code in all our projects. While it is sometimes annoying, ...
Read more >
Style and Consistency Rules with StyleCop
I will show you how to configure and use StyleCop in your automation projects. ... For best results, stylecop.json should be included in...
Read more >
Shared Stylecop.json Between Projects in Visual Studio
In Visual Studio, we can “Add as link” to add a link to a file in another project in the solution. What? Let's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found