Is there a code style config which respects StyleCop rule SA1116 ?

Answered

Motivation

We use StyleCop on our project and are trying to move towards an automated code formatting work-style.

We are also aiming to have a maximum line length of 100 characters.

Problem

The code formatting feature of Rider is quite powerful, but I cannot find a code style configuration, which respects the StyleCop rule SA1116 Split Parameters Must Start On Line After Declaration.

The ideal would be to have the parameters/arguments on a single line,
if the line length doesn't exceed the limit;
otherwise have a chop_always behavior, but even chopping the first parameter/argument.

As an example, either have

interface IA
{
  void M(int p1, int p2);
}

or

interface IA
{
  void SomeMethod(
int longParamName1, int longParamName2, int longParamName3, int longParamName4); }
6
2 comments

Hello Csopimaci, apologies for not providing an update on your question earlier.

Please take a look at the following settings in "File | Settings | Editor | Code Style | C# | Arrangement of Method Signatures":

  • Wrap formal parameters
  • Max formal parameters on a single line
  • Prefer wrap after "(" in declaration

These settings should help you achieve the desired result. If you have any questions, please let me know. Have a nice day!

 

0

Thanks, Maria Pleskunina, this is the solution we've settled as well.

0

Please sign in to leave a comment.