-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate 'severity' field for IDE code style editorconfig syntax #44201
Comments
Tag @mikadumont @sharwell |
… IDE projects My prior attempt to enable this as a build warning in dotnet#44164 did not work due to dotnet#44201. This PR actually adds the build enforcement and fixes the violations.
Design Review
|
I'm a bit confused with this change: There's no documentation about diagnostic ids and corresponding rules now. Even if there is one, splitting rule preference and severity into two places is not friendly. I cannot work properly now without MadsK's extension. Please consider to enhance first class IDE support for editorconfig. Ideally, I want a similar experience with IntelliSense of project files: it shows available diagnostic ids and their explanations. Further more, you may create a GUI of it (reusing the parts from VS options). JetBrains Rider is already doing so. |
Tagging @mikadumont - yes, we understand the concerns, but allowing controlling severity for each option, and then mapping it to severities of specific diagnostic ID(s) is difficult to implement in the compiler. As you mentioned, I think the best option is to provide a GUI for editorconfig to allow users to get the experience of controlling severity for each code style without having to be affected by how these are represented in the underlying editorconfig, which can still have separate entries for severity and code style value. |
Have I understood correctly that the proposed solution is to go with a separate setting for the severity, while using a rule ID to refer to it? The rule ID is opaque and requires either manual lookup in documentation or a UI to do the lookup for you. That seems to be a regression in usability and authoring of Current Solution
Proposed Solution
|
@RehanSaeed The proposed solution is:
|
Actually, I think we might have couple of ways to get around not deprecating the code style syntax for severity setting:
In both these cases, all rules get turned on for build as warnings and once that is done, both the syntaxes for severity setting should work fine to change the severity or disable rules with subsequent editorconfig entries. |
https://developercommunity.visualstudio.com/content/problem/1116079/editorconfig-improvement.html shows an example for a user who contradicts the claim made by @RehanSaeed that configuring the severity of code style options by code style value name is easier to remember as compared to using diagnostic IDs. They prefer the other way. I think this shows that @jmarolf's work towards a UI to help users view and configure styles and severities without worrying about the underlying syntax is extremely important. |
Contributes towards dotnet#44201 - All code style option editorconfig entries can now be specified as `option_name = option_value` without `:severity` suffix - `Configure code style option` code fix will no longer add add `:severity` suffix for new entries. For fix that changes existing entries which have `:severity` suffix, it will retain the existing severity suffix. Note that `Configure severity` code fix was already switched to use `dotnet_diagnostic.RuleID.severity` entries for code style diagnostics in dotnet#47052. Once we have the editorconfig UX to change code style option value and severity, we can safely deprecate the `:severity` suffix in option value syntax. All our UI gestures will use the `option_name = option_value` syntax for code style value changes and `dotnet_diagnostic.RuleID.severity = severity` syntax for severity changes and users do not need to deal with these manually editing or understanind these different syntaxes or mapping rule IDs to option names and vice versa for code styles.
Even though I have set
Am I correct in thinking that I need to wait for VS 16.9 to completely switch over? |
I can confirm that using vs2019 16.8.4 with sdk 5.0.102 the (soon...but how soon?) deprecated syntax often is necessary to see warnings (and avoid analyzer exceptions, in some rare cases: csharp_prefer_braces = when_multiline:warning So when should the syntax be switched over? |
@maxild Starting 16.9, all code style options can be written without severity suffix. |
For backward compatability I have been using both forms for setting severity. What version of VS will the older |
|
dotnet/roslyn#44201 csharp_style_unused_value_expression_statement_preferenceを除く。
How will this work when multiple code style options map to 1 rule? E.g. if I have:
My understanding is that |
Good question @vikekh! I really hope that we won't loose those separate severity settings. |
@mavasani What is the latest on this? Which version of VS can we expect to use the new syntax? Also, how will this #44201 (comment) work? |
Given the customer feedback, we decided to not deprecate the Closing this issue as Won't fix. |
Current IDE code style options support the following editorconfig syntax:
For example:
Command line compiler supports configuring severity of a specific diagnostic ID with the following editorconfig syntax:
This former syntax (
option_name = value:severity
) allows configuring both code style option value and severity. However, the severity setting from this syntax is only respected when executing the corresponding analyzer in the IDE live analysis. This syntax is not recognized by the command line compiler and/or the analyzer driver, so the severity setting above is redundant when executing from an explicit command line build. Additionally, with the command line compiler optimization implemented in #43546, we no longer execute hidden/suggestion analyzers in command line builds, unless the user has explicitly specified the analyzer diagnostic ID as a warning or error with thedotnet_diagnostic.RuleID.severity = severity
syntax. This essentially means that the only way to enforce an IDE code style rule on command line build from our CodeStyle NuGet package is by using the latter compiler recognized syntax. Given this behavior, we should deprecate the former syntax and only allowoption_name = value
in the code style option syntax, and require the latter syntax for severity configuration.The text was updated successfully, but these errors were encountered: