Closed Youssef1313 closed 3 days ago
Part of my editorconfig:
# Default severity for analyzer diagnostics with category 'Style' dotnet_analyzer_diagnostic.category-Style.severity = warning # IDE0022: Use block body for methods csharp_style_expression_bodied_methods = when_on_single_line # IDE0021: Use block body for constructors csharp_style_expression_bodied_constructors = when_on_single_line
The following code generates a warning:
internal class LocalLinkValidator : ILinkValidator { private readonly string _baseDirectory; // Warning on the following line: public LocalLinkValidator(string baseDirectory) => _baseDirectory = baseDirectory; }
It's not clear to me why there is a warning? I'm using an expression bodied member when on single line per editorconfig.
That is because your editorconfig file configured it to warn when the body is of a single line, did you mean to make it to when it's not a single line?
@AraHaan I think csharp_style_expression_bodied_methods = when_on_single_line
should mean that this is the style I want. Not the style I would like to be warned for.
But adding @CyrusNajmabadi to confirm.
For better or worse, this is what it means. Having the names of the options/knobs be totally clear is def something we want, but not something we always get.
Part of my editorconfig:
The following code generates a warning:
It's not clear to me why there is a warning? I'm using an expression bodied member when on single line per editorconfig.