StyleCop analyzes C# source code to enforce a set of style and consistency rules.
Questions tagged [stylecop]
643 questions
0
votes
1 answer
Visual studio style error "sa1505"
I keep getting these style "errors" when I compile, and I don't want them. I can't find any reference to stylecop on my hard drive, but everything on the web seems to suggest that these errors result from stylecop. How do I turn them off? They…

user2701222
- 1
- 1
0
votes
1 answer
How to suppress stylecop on a namespace level?
I tried using the following directive to tell StyleCop to avoid an entire namespace:
[module: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "*", Justification = "Reviewed. Suppression is OK here.")]
However,…

appsecguy
- 1,019
- 3
- 19
- 36
0
votes
3 answers
StyleCop Visual Studio Snippets
I'm looking for some Visual Studio snippets for implementing style cop rules.
For instance when style cop returns an error saying my code needs a documentation header it would be useful to have a snippet that creates this header for me.
Has anyone…

AJM
- 32,054
- 48
- 155
- 243
0
votes
1 answer
Can you create a whitelist of stylecop rules instead of a blacklist?
I'm working on a project which is using StyleCop to police its coding policies. From working on other projects, I have StyleCop+ rules installed. Because StyleCop runs all the rules it can find, the additional rules are running on my local builds,…

Paul Turner
- 38,949
- 15
- 102
- 166
0
votes
2 answers
Would like to integrate fxcop 10.0 and StyleCop 4.7 with TortoiseSVN 1.7.6 through pre-commit hook script
For FxCop Integration with SVN,
Requirement: Whenever, a developer tries to checkin the code in SVN, Fxcop should run and check if all files are as per rules or not. If not, then file commit should not be allowed in SVN.
Implementation:
Added a…

Apoorve
- 1
- 1
0
votes
2 answers
Fields must be declared with private access. Use properties to expose fields.
I get this warning from stylecop always. this makes sense from class perspective. fields should be private and use property to expose the fields
but i have a codebehind where i have declared a control as below. and this warning doesn't make sense.
…

neha
- 1
- 1
- 1
0
votes
0 answers
Is it necessary to follow the stylecop rule?
My project now has to be put to SONAR which is the code analysis tool - http://www.sonarsource.org/ . does the styling from stylecop also matters in the code quality?
is that necessary to follow the stylecop? The steps in this site seems to be very…

roopini n
- 503
- 2
- 7
- 29
0
votes
1 answer
Settings.StyleCop won't suppress SA1504
I am manually editing a Settings.StyleCop file to configure stylecop in VS2012. So far, I've had success suppressing many unwanted rules, but SA1504 won't go away. I'm using stylecop 4.6.
Here's a snippet of my settings file:

ChaseMedallion
- 20,860
- 17
- 88
- 152
0
votes
1 answer
Issues while using Stylecop addin for Monodevelop
I am trying to use the Stylecop addin for Monodevelop - http://addins.monodevelop.com/Project/Index/54. I have a custom policy file that i use in Visual studio (its a Settings.Stylecop file), and now i want to use the same in Monodevelop (Xamarin…

user2141477
- 75
- 1
- 7
0
votes
2 answers
StyleCop vs DependencyProperties
I always tend to group all stuff that belongs to a dependency property (registration, clr property, change callback, coerce callback etc.) into one region. But this violates the stylecop member ordering rules. This is also a general problem with…

bitbonk
- 48,890
- 37
- 186
- 278
0
votes
0 answers
Programatically check github diff with Stylecop SDK
I am trying to create an utility that will get automated code review for code on github using stylecop rules.
Right now the stylecop SDK works only with the entire file - so to make review for the commit I need to download the file and run stylecop…

chaZm
- 404
- 1
- 3
- 11
0
votes
1 answer
Linking StyleCop settings files
I have two settings files in my project. One lies next to the Visual Studio solution file. The other one is in an subfolder which is used for export to other products we develop.
...
solution.sln
settings.stylecop (linked to the other settings…

Antineutrino
- 1,093
- 3
- 10
- 26
0
votes
1 answer
stylecop / resharper configuration to not add comments
how to configure stylecop or resharper to NOT add meaningless comments when doing "cleanup code"??
OK (KEEP/NICE TO HAVE):
have region tags:
#region Public Properties
REMOVE:
///
/// Gets or sets the description.
///…

ShaneKm
- 20,823
- 43
- 167
- 296
0
votes
3 answers
Issues setting up StyleCop and FXCop with Jenkins
I have installed the Jenkins Violations plugin v0.7.11 and I am having an issue getting it to display FXCop and StyleCop violations.
In the settings I have entered the recommended XML filename pattern as:
**/*/FxCopViolations.xml…

magritte
- 7,396
- 10
- 59
- 79
0
votes
1 answer
Under what circumstances would StyleCop choose to skip a file?
I have a solution that contains twenty c# projects. Until recently, StyleCop would run against all files, except auto-generated files, across all projects and report any issues that it found. Recently (it's not clear exactly when) it has become…

Montgomery 'monty' Jones
- 1,061
- 2
- 14
- 27