ReSharper conflicts with Stylecop over directive order SA1210 SA1211

The StyleCop 4.7 SA1210 and SA1211 rules require that the use directives be sorted alphabetically. I ran into a conflict between the StyleCop rule and the applied Resharper sort: case sensitivity.

Resharper 8.2 is case-insensitive, while the StyleCop rule requires case-sensitive sorting. So, I came across a strange case with the following directives due to the wrong choice of namespace (not mine):

using AB.Common; using ab.Utility; 

First, press ctrl-EF; but the rule requires the utility to be first because of the difference between AB and ab. I walked past him, removing the StyleCop rule and simply allowing Reharper reformat. Of course, the namespace itself needs to be reorganized, but I do not have this option.

Any other opinions on how to handle this other than disabling the StyleCop rule?

+5
source share
1 answer

Converting a StyleCop rule seems like the best answer; there is no need for ReSharper or StyleCop to check the order.

But if you want both of them to be included, you could have a namespace alias look something like this:

 using Common=AB.Common; using Utility=ab.Utility; 
0
source

Source: https://habr.com/ru/post/1204920/


All Articles