-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
RR0064 (and probably others) don't respect .editorconfig rules #473
Comments
I agree that Roslynator should work in compliance with editorconfig rules. Unfortunately there is no API to access these editorconfig rules (at least none I know of). |
Looking at the Roslyn PR that added support for .editorconfig, it seems that:
including ones that cover both the IDE and/or tl;dr: given a var optionSet = context.Options.GetDocumentOptionSetAsync(context.Node.SyntaxTree, context.CancellationToken).GetAwaiter().GetResult();
var option = optionSet.GetOption(CodeStyleOptions.<relevant-option-name>, <language>);
// do something with option.Value The relevant one that covers this particular case (RR0064) seems to be |
Regarding Editor config, if you could take a look at my comment on #427 (comment) |
@wiz0u I reopened it. |
It's possible to set rule severity in |
@marcospgp It possible to configure rules using editorconfig. Here is a list of currently supported values: roslynator.max_line_length = <MAX_LINE_LENGTH>
roslynator.RCS0011.invert = true
roslynator.RCS0015.invert = true
roslynator.RCS0027.invert = true
roslynator.RCS0028.invert = true
roslynator.RCS0032.invert = true
roslynator.RCS0051.invert = true
roslynator.RCS0052.invert = true
roslynator.RCS1014.invert = true
roslynator.RCS1014.use_implicit_type_when_obvious = true
roslynator.RCS1016.invert = true
roslynator.RCS1016.use_block_body_when_declaration_is_multiline = true
roslynator.RCS1016.use_block_body_when_expression_is_multiline = true
roslynator.RCS1018.invert = true
roslynator.RCS1036.remove_empty_line_between_closing_brace_and_switch_section = true
roslynator.RCS1045.suppress_when_field_is_static = true
roslynator.RCS1050.invert = true
roslynator.RCS1051.do_not_parenthesize_single_token = true
roslynator.RCS1078.invert = true
roslynator.RCS1090.invert = true
roslynator.RCS1096.invert = true
roslynator.RCS1104.suppress_when_condition_is_inverted = true
roslynator.RCS1207.invert = true
roslynator.RCS1213.suppress_unity_script_methods = true
roslynator.RCS1246.suppress_when_expression_is_invocation = true
roslynator.RCS1248.invert = true |
Awesome, was just checking back in to say that |
My solution has a
.editorconfig
file in its root with the following rules defined:Performing a refactoring on a constructor parameter in that solution yields the following:
Roslynator's "Introduce and initialize field" refactoring (RR0064) wants to generate a field name that doesn't begin with an underscore (i.e. the
.editorconfig
rules are ignored), while Visual Studio's built-in refactoring "Create and initialize field" produces the correct field name In my opinion, Roslynator should behave the same as Visual Studio in respecting the.editorconfig
rules.I'm aware of the Roslynator option "Prefix field identifier with underscore" but to my knowledge that applies to all fields, and it would be unnecessary if the
editorconfig
rules were used.The text was updated successfully, but these errors were encountered: