This project is read-only.

2 simple questions on StyleCop

Mar 6, 2012 at 12:42 PM

Hi all,


I'm new to StyleCop and I have 2 simple questions about it, that I could not answer by browsing through the documentation:


1. StyleCop sometimes gives output like

"Pass 1: File1.cs

 Pass 1: File2.cs

 Pass 2: File1.cs

 Pass 2: File.cs"

etc. What do the multiple passes mean as opposed to

"Pass 1: File1.cs

 Pass 1: File2.cs"?


2.  Rules SA1008 and SA1009 are called "OpeningParenthesisMustBeSpacedCorrectly" and "ClosingParenthesisMustBeSpacedCorrectly" respectively. Where do I set what the correct spacing should be? In the Visual Studio text editor options for C# I've checked "Insert space within argument parentheses", and my code is formatted accordingly, but StyleCop complains that SA1008 and SA1009 are violated. What must I do to tell StyleCop that those spaces are correct?


Thanks for any tips


Mar 6, 2012 at 3:28 PM


1. For some files some StyleCop rules need to process the source file twice in order to check some of the rules.

2. You cannot 'set' the correct spacing. StyleCop has the correct spacing. You can turn the rule on/off.

Mar 6, 2012 at 4:38 PM

Hi andyr,


thanks for your really quick answer.

ad 2.: Does that mean that I have to write a custom rule to allow/check for spaces after (before) opening (closing) parentheses?

Mar 6, 2012 at 5:23 PM

yes. Or adopt the StyleCop standard.

Mar 6, 2012 at 6:05 PM

Ok, thanks.