stylecop

How can you force StyleCop for ReSharper to ignore files?

醉酒当歌 提交于 2019-12-30 03:03:10
问题 We’ve just been working on introducing StyleCop to our team and are using the StyleCop ReSharper plugin from Code Plex. Problem is, every single file in the project appears to be getting analysed and we can’t find a way to exclude particular files. This includes files such as the designer.cs file from the DBML or third party components included in the project. What this means is your site wide code analysis in ReSharper always shows up errors and you can never get it to go “green”. There’s

Is there a StyleCop/FxCop autofixing tool? [closed]

爱⌒轻易说出口 提交于 2019-12-29 19:22:08
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . Is there a tool that can automatically fix StyleCop and FxCop rules, rather than manually fixing thousands of warning and errors? There must be one, it is such a good business opportunity! 回答1: No, frustratingly . That's why Style Cop is counter-productive. Consistent formatting looks nice, but there's little

How to check all projects in solution for some criteria?

你说的曾经没有我的故事 提交于 2019-12-29 09:15:53
问题 I need to let all projects in solution contain some additional build actions, e.g. StyleCop validation, autogenaration of AssemblyInfo's, etc. My idea is to make some kind of solution-wide prebuild event that will check all project files for containing nodes that match specific xPath. It's not a hard part, it can be solved either with custom build task, or with some third-party Xml handling task. I didn't investigate it deeply yet, but it definitely won't make a problem worth mentioning here.

How to check all projects in solution for some criteria?

社会主义新天地 提交于 2019-12-29 09:15:18
问题 I need to let all projects in solution contain some additional build actions, e.g. StyleCop validation, autogenaration of AssemblyInfo's, etc. My idea is to make some kind of solution-wide prebuild event that will check all project files for containing nodes that match specific xPath. It's not a hard part, it can be solved either with custom build task, or with some third-party Xml handling task. I didn't investigate it deeply yet, but it definitely won't make a problem worth mentioning here.

When running Stylecop in Sonar, how do I make it analyze projects identified as test projects?

可紊 提交于 2019-12-25 02:09:47
问题 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 file: #Core C# Settings sonar.dotnet.visualstudio.solution.file=SomeSolution.sln sonar.dotnet.excludeGeneratedCode=true sonar.dotnet.version=4.0 sonar.donet.visualstudio.testProjectPattern=*.Tests #StyleCop sonar.stylecop.mode= Reading the sonar build log I

Find out if CsElement is a static field? (StyleCop custom rule)

a 夏天 提交于 2019-12-24 07:05:22
问题 How do I query a CsElement object to see if the element is a static field? I'm building a pair of m_ and s_ prefix rules for member fields and static fields. 回答1: You definitely should take a look at StyleCop+. It already contains all naming rules you're trying to create. Moreover, it's open-source. So you can find there many examples of different code analysis cases (finding all static fields, member fields, etc.) 来源: https://stackoverflow.com/questions/6037695/find-out-if-cselement-is-a

How to set stylecop.json creating Stylecop Anayzers plugin for Sonarqube?

帅比萌擦擦* 提交于 2019-12-24 05:49:22
问题 I want to use the rules of the StyleCop analyzer for Roslyn in SonarQube, In order to do that and following the documentation founded, I downloaded the SonarQube Roslyn SDK, and I generate the plugin. In my development environment I have a JSON file (stylecop.json) that add configuration: { "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", "settings": { "documentationRules": {

Resharper: File header text not automatically used for new files

杀马特。学长 韩版系。学妹 提交于 2019-12-23 13:00:07
问题 I am using VS2010, Resharper 8.0.1, StyleCop 4.7.45. I have defined a File header text in the resharper options and (wrongly) assumed it would then be used when refactoring (using "move class to a new file to match file name" function). This also doesnt use the Visual Studio file templates that one may modify (see How do I edit the Visual Studio templates for new C# class/interface?). Is there a way to enable that behaviour, or do I always have to manually trigger Code cleanup afterwards? 回答1

version control over visual studio formatting style

眉间皱痕 提交于 2019-12-22 12:34:30
问题 What's the way to go if I want to have a consistent style standard versioned? I want to achieve two things: Pressing ctrl-k,ctrl-f (auto indenting) formats the code based on a shared standard Stylecop runs against shared rules What files do I have to add in my git repository to achieve this? 回答1: You can add a pre-commit hook. You can version in your git repo a hook script (say pre-commit.sh ) at the root of your project and include the installation instructions in your README/documentation

How to create a Visual Studio build configuration with StyleCop code analysis disabled?

≡放荡痞女 提交于 2019-12-22 09:57:23
问题 Question I have installed StyleCop and now there are StyleCop squiggly lines all over the source code. Now, I'd like to be able to temporarily enable and disable StyleCop's analysis. I would have expected a checkbox saying "Disable StyleCop", instead, the Internet tells me that I have to create a new Visual Studio build configuration called "Debug without StyleCop" open the project *.csproj file and do all kinds of nasty things in there. Can anyone please provide a step by step instruction on