StyleCop analyzes C# source code to enforce a set of style and consistency rules.
Questions tagged [stylecop]
643 questions
0
votes
1 answer
How to exclude specific styleCop rules permanently?
I have some rules which i don't need to follow according to them , so i'm looking for a way - how to disable these specific rules from every project i'll make, from now on, in visual studio 2010.
Thanks,

sharon182
- 533
- 1
- 4
- 19
0
votes
1 answer
Stylecop: getting too many errors like SA1400 when using a parent settings file
I have a (company-given) stylecop settings file with a handful of rules.
This I placed into the parent folder for my project (test project, local, no source control - stylecop settings still say "Merge with settings file found in parent…

Andreas Reiff
- 7,961
- 10
- 50
- 104
0
votes
1 answer
When running Stylecop in Sonar, how do I make it analyze projects identified as test projects?
Ok, so let's assume that I want to live according to the rule, treat your test code as carefully as your production code. How do I make Sonar and Stylecop analyze my test projects?
I've basically written this in my sonar-project.properties…

8DH
- 2,022
- 23
- 36
0
votes
1 answer
Resource Designer Files - Change Template
When changing a localized resource file, such as resources.de.resx the designer code gets regenerated blank.
How can I change this to be the auto generated code…

NikolaiDante
- 18,469
- 14
- 77
- 117
0
votes
1 answer
How can I integrate stylecop 4.7 with TeamCity 7.0.3
I've dowloaded the stylecop teamcity plugin from
https://bitbucket.org/metaman/teamcitydotnetcontrib/overview
I've added it as a build step and am trying to make it scan my cs. proj files. Can you please help me with the file inclusion pattern.…

pmanolov
- 623
- 1
- 6
- 19
0
votes
1 answer
SQLDataReader connection close
How to define rule in stylecop to force developer to close SQLDataReader() or connection?
if there exists any other solution then also please suggest.
The solution required is to force developer to close sqldatareader
or
we can do any other…

Dr. Rajesh Rolen
- 14,029
- 41
- 106
- 178
0
votes
1 answer
StyleCop Custom Rule: Get the Type of a variable when checking assignments
I'm writing a custom StyleCop rule to prevent String variables being assigned null, and am encountering a problem!
I can easily prevent a String variable being assigned null during the declaration with the following code:
if…

Mike Insch
- 302
- 3
- 14
0
votes
1 answer
Where can I look up the namespaces for stylecop rules so that I can suppress them?
There seem to various questions asking specifically how to suppress particular stylecop warnings, for example:
[SuppressMessage("Microsoft.StyleCop.CSharp.OrderingRules", "SA1202:ElementsMustBeOrderedByAccess"]
But where can I authoratively look to…

Silas Davis
- 712
- 1
- 9
- 15
0
votes
1 answer
How should sonar be configured to work with StyleCop 4.7
I am attempting to get sonar to work with StyleCop 4.7 and am having a few issues.
1) When I set the location of StyleCop in the Sonar settings, Sonar fails to run and therefor fails my CI builds. It seems that Sonar is unable to find the…

TheDevOpsGuru
- 1,570
- 5
- 21
- 36
0
votes
1 answer
StyleCop SDK: How to get names of parameters of method containing an element?
I wish to write a custom rule for StyleCop that is the opposite of SA1101; namely, I want a violation to occur if there is a redundant this. (similar to ReSharper). This happens if the methods/indexers/delegates/constructors containing the element…

cubetwo1729
- 1,438
- 1
- 11
- 18
-1
votes
1 answer
Which is better style, an ambiguous, notated, or renamed parameter?
Stylecop seems inconsistent in naming parameters or perhaps I'm missing something?
I have
Movement movement;
public void SetMovement(Movement movement)
{
this.movement = movement;
}
which complains about my parameter hiding…

Popsucker
- 3
- 1
-1
votes
1 answer
SonarQube ignoring disabled stylecop rules
I am using SonarQube 5.0 on Windows 7 with the C# plugin 3.3, Analysis Bootstrapper for Visual Studio Projects 1.2 and Stylecop plugin 1.1 installed to analyse my C# solution.
I have disabled a number of stylecop rules inside SonarQube (mostly…

Nick Udell
- 2,420
- 5
- 44
- 83
-2
votes
2 answers
can stylecop prevent disk i/o in unit tests?
I'm hoping that I can use stylecop to prevent disk IO in unit tests, by preventing explicit method calls that I define.
Have very little experience with stylecop but from what I've gathered it should be able to do this kind of task (prevent given…

Ivar
- 119
- 1
- 1
- 6