Code cleanup and StyleCop woes Follow
I am having trouble with ReSharper 10's code formatting / clean-up in a few ways. I am trying to satisfy StyleCop rules and have run into a couple of issues. I'm not sure if these are bugs, limitations or a matter of settings.
Given the following code:
ReSharper re-formats as such:
I have three issues with the results.
1) The generic constraint on the method Go() do not honor the "Place type constraints on same line" (off) format, yet the class constraint does. This violates StyleCop SA1127 Generic Type Constraints Must Be On Own Line.
2) To satisfy StyleCop's requirement SA1117 Parameters Must Be On Same Line Or Separate Lines, "Value c" above violates this policy. I can't find a way to have ReShaper chop parameters when long, but if so chop all.
3) When chopping method parameters, ReSharper leaves an empty space at the end of each line as seen after the first parameter to MyMethod(). This violates StyleCop's SA1028 Code Must Not Contain Trailing Whitespace.
If I clean this issues up to satisfy StyleCop, another run of Cleanup by ReSharper recreates the issues.
Any advice is appreciated. Thanks.
Please sign in to leave a comment.
I'm in the process of upgrading to VS 2015 and using the StyleCop Analyzers and have noticed the same issues (well 1 & 2 anyway) so came here to raise the same concerns.
EDIT: I found the following issue/s.
Excellent... thanks for finding those; I've added my vote.
Incidentally, issue #3 above seems to be mitigated per my example in ReSharper 2016.1. However, there are many other trailing whitespace issues that remain (as you note).
Edit: Issue #3 above is a matter of ReSharper configuration. The following two settings allow my example to conform to StyleCop rules in this area:
ReSharper | Options -> Code Editing | C# | Formatting Style | Line Breaks and Wrapping -> Line Wrapping ->