Resharper Command Line Tools EditorConfig
Hello Team
Does .EditorConfig works with Resharper CLT? If it does, is there any example/documentation for the same?
I tried working with Resharper CLT (inspectCode.exe) and .EditorConfig but its not working as expected. I expected the rules in .EditorConfig to be used but doesn't look like.
Thanks.
Please sign in to leave a comment.
It should work for 2019.3 or newer versions. Could you please provide extracts from your editorconfig with rules that don't work?
Hi Dmitry
Do you mean **2019.3 or older** or **2019.3 or newer** version? Following are the details:
CLT Details
Editor Config:
Test Code (added below code in one of the files):
Actual Output in Xml file
Received Warning
Was expecting following output:
Was expecting Error
Visual Studio shows the interface name with an error (shown below). If I turn the error to warning in editorconfig - Visual studio shows interface name with warning. So its working as per my expectation.
Please let me know if you need any further details or if I have missed something
Also, is there an example anywhere about how to use EditorConfig with Resharper CLT?
Thanks
Hi Raghavrkapoor!
Of course I mean newer, sorry for confusion.
InspectCode outputs issue severities set on a solution level. To change severities on a solution level using .editorconfig:
1. Please use [*] instead of [*.{cs,vb}]
2. Place your .editorconfig file in the same folder as your .sln file or in any folder above it.
We would think about outputting severities also separately for each found issue.
Hi Dmitry
Thanks for the details. After making the changes you listed above its working as per expectations. I can see the changes made to editorconfig reflected in the output.
Have one more question though -
I was only expecting the output to include details of the rules that are there in the editorconfig file. With editorconfig example that I included in previous comment I expected the output to only include failures for "dotnet_naming_rule.interface_rule". However I can see the details of other rules in the output as well (image below). I want the rules listed in editorconfig to be the only rules that should be run as part of inspection. How can I achieve this?
Raghav.
-----------------------------------
Hi Raghav!
Regarding other rules. That's a problem. By default, ReSharper inspects all naming. We cannot just disable all naming rules when we find an .editorconfig, it would introduce incompatibility with previous versions. We're still researching possible ways to solve this problem. For now, you can add the following lines to your .editorconfig to disable all other naming rules:
# ReSharper properties
resharper_csharp_naming_rule.constants=AaBb:do_not_check
resharper_csharp_naming_rule.enum_member=AaBb:do_not_check
resharper_csharp_naming_rule.event=AaBb:do_not_check
resharper_csharp_naming_rule.locals=aaBb:do_not_check
resharper_csharp_naming_rule.local_constants=aaBb:do_not_check
resharper_csharp_naming_rule.local_functions=AaBb:do_not_check
resharper_csharp_naming_rule.method=AaBb:do_not_check
resharper_csharp_naming_rule.other=AaBb:do_not_check
resharper_csharp_naming_rule.parameters=aaBb:do_not_check
resharper_csharp_naming_rule.private_constants=AaBb:do_not_check
resharper_csharp_naming_rule.private_instance_fields=_ + aaBb:do_not_check
resharper_csharp_naming_rule.private_static_fields=_ + aaBb:do_not_check
resharper_csharp_naming_rule.private_static_readonly=AaBb:do_not_check
resharper_csharp_naming_rule.property=AaBb:do_not_check
resharper_csharp_naming_rule.public_fields=AaBb:do_not_check
resharper_csharp_naming_rule.static_readonly=AaBb:do_not_check
resharper_csharp_naming_rule.types_and_namespaces=AaBb:do_not_check
resharper_csharp_naming_rule.type_parameters=T + AaBb:do_not_check
Thanks Dmitry for the above information.
I am having enough information about editorconfig for now to further my work.
However, I am having another issue related to inconsistent execution times for running inspections which is not related to this query. Will ask a separate query.
Raghav.