Skip to content

Different .editorconfig severity strings are used to specify IDE code style options and dotnet_diagnostic.severity #35690

@mavasani

Description

@mavasani

Version Used:
Latest master source

I found out we use different editorconfig strings for severities specified through our code style options and the ones that the compiler looks for:

DiagnosticSeverity IDE Code style term Compiler dotnet_diagnostic.severity term
Error "error" "error"
Warning "warning" "warn"
Info "suggestion" "info"
Hidden "silent" or "refactoring" "hidden"
Suppress "none" "suppress"

So, user needs to use different terms for specifying severies, which seems very confusing:

[*.cs]

# CA1822: Mark members as static
dotnet_diagnostic.CA1822.severity = warn

# IDE0059: Unnecessary assignment of a value
csharp_style_unused_value_assignment_preference = discard_variable:warning

Compiler generates the following diagnostic if term warning is used for dotnet_diagnostic.CA1822.severity

CSC : warning InvalidSeverityInAnalyzerConfig: The diagnostic 'ca1822' was given an invalid severity 'warning' in the analyzer config file

IDE code style:
Documentation: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2019#language-code-styles
Implementation: http://source.roslyn.io/#Microsoft.CodeAnalysis.Workspaces/NamingStyles/EditorConfig/EditorConfigSeverityStrings.cs,5

Compiler:

I believe the compiler terms should be switched to follow the already shipped terminology or at least the compiler should allow the terms from both columns in the table above

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions