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
Cannot configure severity with editorconfig for analyzer diagnostics with Location.None #37876
Comments
Tagging @jasonmalinowski @sharwell @agocke @jinujoseph I believe this could become a blocker in attempting to migrate from rulesets to editorconfig. I am not sure if there is an easy solution to this issue as the diagnostic does not apply to any specific source location/file/folder. One potential solution could be to apply the settings from the editorconfig file(s) marked with |
This is by design and I'm strongly opposed to changing it. This functionality can be achieved by using |
I am going to re-open this issue so at least the consequences of Won't fixing this can be understood and discussed at IDE design meeting. Also changing it to Area-IDE.
|
I'm with @agocke here. The .editorconfig format is known to not have full parity with ruleset files. The original design proposal included one possible provision to address this, but after discussion the provision was rejected. Outside of new evidence related to this (e.g. an intent to remove compiler support for ruleset files), I don't see a need to bring this to a design review again since a conclusion on the matter was already reached. Diagnostics without a location, and diagnostics reported in files not contained in the directory tree under the solution root (including but not limited to files included as links into the shared NuGet packages directory and files in the temporary files directory) cannot be configured with .editorconfig files. |
I disagree strongly with the push back to bring this to IDE design meeting. We most certainly need to discuss this as the assertion here means we conclude we cannot offer an automated tooling or migration path for customers from rulesets to editorconfig, hence do not have a path forward to deprecate rulesets and ruleset editor. Additionally, we cannot claim that rulesets can be deprecated as existing IDE tooling, such as set ruleset severity command in analyzers node, cannot be moved to use editorconfig based configuration. |
Actually, I thought of a workaround from analyzer driver side that can resolve this issue. I am going to implement it and move this issue to Area-Analyzers, removing the Needs Design Review tag. |
Design Review: For current release we will fix bugs but consider that editorconfig is not a direct replacement of ruleset. In next release we will evaluate gaps and coordinate with compiler team to find resolution and if editorconfig should be a full replacement for ruleset. We will continue to promote editorconfig as the solution for NEW projects. |
Reactivating this -- should we keep this open in the project for tracking the known issues when we discuss further? |
What is the state of this problem? I justed startet migrating rulesets to editorconfig as "highly recommended" here: https://docs.microsoft.com/en-us/visualstudio/code-quality/use-roslyn-analyzers?view=vs-2019 Now CA1014 is no longer a warning and i'm unable to change this bei editorconfig. Maintaining ruleset and editorconfig is very confusing as you never know, which file is used for which rule. This can't be the right way.... I can't understand how you could highly recommend something, which is working so bad. |
@CC84 Configuring no location diagnostics with editorconfig should work with the the global analyzer config support that was recently added by @chsienki with #43889. This should be supported in VS2019 16.7 or later
is_global = true
dotnet_diagnostic.CA1014.severity = warning
|
Actually, I spoke too soon. I expected that global analyzer config would have resolved this issue, but it seems that it still does not. The following code in diagnostic filter logic that looks at editorconfig for effective severity only works for diagnostics with location (needs non-null syntax tree): roslyn/src/Compilers/CSharp/Portable/Compilation/CSharpDiagnosticFilter.cs Lines 154 to 159 in ffbb9c7
@chsienki @agocke we need to update that logic to look at diagnostic severity settings from global analyzer config files for no location diagnostics. |
@CC84 So you would need a ruleset or editorconfig entry to enable this rule, and given this issue, ruleset seems to be the only route to enable it as of now. |
@mavasani What's the issue here? That we're not checking the global config for the value? I thought that it should make it to the tree by virtue of the analyzer config set. From that point on there shouldn't be any special global config handling, no? |
@chsienki - The core issue is for analyzer diagnostics without location or
|
We should put the global options that apply to all syntax trees into the SpecificDiagnosticOptions attached to the compilation, not the per-syntax tree options. This should solve the problem. |
Is there roadmap, when it will go on? |
Is this in any way related to Visual Studio ignoring this
I have a Core project that builds both Core and legacy .NET 4.8 targets. This new project structure doesn't even include analyzers anymore, unless I manually modify the project's XML by hand. And I don't even know if analyzers even work in Core projects? I had the impression I'm supposed to use |
rulesets work well in dotnet core, same as editorconfig, although not sure what version of vs is needed. I am using vscode and this was aded only recently, but less so on vs. |
and analyzers do work, I mean, the roslyn analyzers. |
[*.cs]
dotnet_diagnostic.IDE0062.severity = none Above entry in your .editorconfig should suppress all IDE0062 for files and folders under that directory. |
Faced the same problem, workaround with global .editorconfig doesn't work :( |
@vchirikov I have verified that the issue is now resolved in internal 16.8 Preview3 dogood builds with recent global analyzer config changes from @chsienki. Attaching the modified class library from the issue description with a global analyzer config instead of a ruleset and it does the same job. |
Hi, when using
So it seems that SDK-level globalconfig clashes with project-level one. Am I missing something or there is no way to disable no-location warning without getting another one in opt-out mode? |
I'm using |
@beho @ChrisTorng This is a known issue that will be addressed when @chsienki implements #48634 to allow user specified global config to override SDK/NuGet provided global config. Until that feature is implemented, you can workaround by disabling this rule in MSBuild props/project file: <PropertyGroup>
<NoWarn>$(NoWarn);CA1014</NoWarn>
</PropertyGroup> |
@mavasani any news on this issue? But it doesn't work in 16.10.0 Preview 4.0 |
@p-bojkowski The configuration needs to be placed in .globalconfig, which is the true functional replacement for a rule set file. This is like .editorconfig, except it has |
thx @sharwell ! It's working :) |
Why does the IDE imply these settings are editable then by allowing the Severity listbox selection to be changed then? If this was the design, then the IDE should reflect this design decision by making the severity read only. |
Version Used: Latest 16.3 dogfood preview build
Steps to Reproduce:
[*.cs]
for the section header):Expected Behavior:
2 errors similar to behavior when ruleset was used
Actual Behavior:
Only one error for CA1040
CA1014 being a project level diagnostic with
Location.None
doesn't seem to be configurable from editorconfig file. This issue applies to all project level analyzer diagnostics, CA1014 is not special.The text was updated successfully, but these errors were encountered: