Dinking around with stylecop settings files is getting annoying and messing with my repo structure. The repo is like this:
+ Trunk
+ src
- ProjectA
- ProjectB
- ...
+ lib
+ Icons
- ...
+ tools
+ NUnit
+ PartCover
- Settings.StyleCop
- ...
I would like ...
Hello,
I need to run StyleCop every time a website project is built in a development machine. I am able to run StyleCop automatically in projects which contains *.csproj files, however Website projects doesn't have such files.
Is there a easy way to do that?
Thanks in advance.
...
We are seeing extremely strange results where StyleCop will correctly report violations when run from within Visual Studio 2010. However, when we run msbuild on the command line (e.g., "MSBuild.exe mySolution.sln") it reports "No violations encountered" when clearly there are the same violations as when we ran it within Visual Studio. I...
These 3 types of lock are apparently bad.
What other type of locking is bad?
Are there Stylecop / FxCop rules that would catch this?
If not, then would you please help me with a custom rule implementation? They code for all of them must be similar, right?
Thank you.
...
Some problems that I recall (there may be more):
Includes regions
Does not use this. prefix for member variables and methods
Includes comments like the one below ( having // by itself catches the eye of StyleCop)
//
// fileNameTextBox
//
If I make a change to the text, and then open the designer again, and screws up my previously ...
I like to adhere to StyleCop's formatting rules to make code nice and clear, but I've recently had a problem with one of its warnings:
All using directives must be placed
inside of the namespace.
My problem is that I have using directives, an assembly reference (for mocking file deletion), and a namespace to juggle in one of my t...
I am a big fan of Stylecop and I always follow it guidelines. I also follow the guideline that state that a comment should bring added value to the code and not repeat what the code is doing.
I'm having a bit of trouble following the commenting guidelines concerning an ASP.NET MVC Controller and its related actions: I can't think about ...
I like to create xml using the following formatting:
XDocument xml = new XDocument(
new XElement("Root",
new XElement("A",
new XAttribute("X", xValue),
new XAttribute("Y", yValue)),
new XElement("B",
new XAttribute("Z", zValue)),
new XElement("C")));
It seems easy to read and kinda flows...
Hi,
I sometimes use braces to isolate a block of code to avoid using by mistake a variable later. For example, when I put several SqlCommands in the same method, I frequently copy-paste blocks of code, ending by mixing the names and executing twice some commands. Adding braces helps to avoid this situation, because using a wrong SqlComm...
Is there any tools like StyleCop for SQL Server?
We need the same features of StyleCop (enforce a set of style and consistency rules).
[Additional Feature]: Integration with SQLServer Management Studio would be cool.
...
I work in a team where we use extensive ruleset in StyleCop and I am wondering what are the thoughts on the general point where such a tool stops being useful and starts becomes annoying. We also use GhostDoc so code is riddled with XML comments which make the code much harder to read and thus review. I have no problem with XML comments ...
I'll prefix by saying that I understand that both Code Analysis and StyleCop are meant as guidelines, and many people chose to ignore these anyway. But having said that, I'd like to see what the general consensus is with regard to these two rules.
Rule CA1500 says don't make parameter names and private field names the same.
Rule SA130...
I am recieving warning about my file by StyleCop.
Warning 1 CR0005: The file is very long at 508 lines. Please consider refactoring to make it 500 or fewer lines.
Warning 2 CR0002: Method is too long. It is 58 lines long. Consider refactoring to make it 50 or fewer lines.
How are you guys making changes to your codes? What are...
I'm using StyleCop and want to suppress some warning which does not suit my style. I prefer to have solution for 1) in-line code suppressing and 2) global setting suppressing . I've searched the internet but still not sure how to do the suppressing. For method 1), They said to add the lines
[assembly: SuppressMessage("Microsoft.Design"...
I'm writing a group of methods which are a mix of private/public and need to put into the same region (using #region). I used method mentioned in here but I can not get this warning supressed. Please help.
[Edit]
I need to supress this particular warning only - not for the whole project/solution. But I'm willing to know how to do that ^...
The code below looked ok to me when I wrote it, but when I came back to it again, it was pretty hard to grasp what is going on. There used to be parenthesis around value == ..., but I had to remove them after StyleCop became mandatory (I cannot really control this). So, how can I improve this section of code? I was thinking: x = value ==...
Hi,
Is it possible to get StyleCop to say that this is the correct way to use curly braces?
if (request.Query == string.Empty) {
return SearchResponse.Empty;
}
But not this
if (request.Query == string.Empty)
return SearchResponse.Empty;
Or this:
if (request.Query == string.Empty)
{
return SearchResponse.Empty;
}
I a...
I would like to add a StyleCop SuppressMessageAttribute to some code but I don't want to require StyleCop to be installed.
Does my project need to reference the StyleCop binaries and if so, which ones? Also, is the StyleCop SuppressMessageAttribute different to the System.Diagnostics.CodeAnalysis.SuppressMessageAttribute?
...
How can i parse a particular .Cs file using Style-cop .Net code?
...
Sometimes there is a need for lengthy comments. This can happen when there is a fugly hack which needs long explanation. Yes, it is better to avoid/fix the hack altogether, but often there is time pressure and one has to push it off into the future. If that is the case, then having a detailed comment is quite helpful, including those who...