stylecop

Enabling StyleCop.Analyzers on ASP.NET Core projects

非 Y 不嫁゛ 提交于 2019-12-06 06:25:29
According to the docs I've read online all you need to do is add the following to the dependencies in project.json: "version": "1.0.0-*", "dependencies": { "DependencyA": "1.0.0-*", "DependencyB": "1.0.0-*", "StyleCop.Analyzers": { "version": "1.0.0", "type": "build" } }, "frameworks": { "net46": { } } (where DependencyA and DependencyB are two .NET Core projects from the same solution) and then StyleCop.Analyzers will run with the default rule set upon building the project. It doesn't. I get no warnings or anything and I'm pretty sure the code at the moment violates a lot of rules. Did anyone

How to combine multiple custom StyleCop rules under a single “Custom Rules” node in StyleCop settings and concurrency

两盒软妹~` 提交于 2019-12-06 05:54:07
问题 Based on several good articles I have been able to successfully create a few custom StyleCop rules. For reference, a few articles I found very useful on this topic are listed here: How to Implement a Custom StyleCop Rule Creating Custom Rules for Microsoft Source Analyzer - Part I Creating Custom Rules for Microsoft Source Analyzer - Part II Creating Custom Rules for Microsoft Source Analyzer - Part III I am using Visual Studio 2010 Ultimate edition along with StyleCop version 4.4.0.14.

Using StyleCop in Asp.net Core

我是研究僧i 提交于 2019-12-05 10:40:49
According to this this article for using StyleCop in Asp.net Core, 1)Add the following to the dependencies section of the project.json file: "StyleCop.Analyzers": { "version": "1.0.0", "type": "build" } and build the project. 2) Create stylecop.json and add your configuration on it, this is my stylecop.json content: { "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", "settings": { "documentationRules": { "documentInterfaces": true, "documentInternalMembers": false } } } 3) the following

Is StyleCop 4.7 compatible with C# 6.0 code

不羁岁月 提交于 2019-12-05 06:55:37
I installed StyleCop 4.7 for developing customized rules, to analyze our C# code. We write the code in Visual Studio 2015. I can analyze my C# 5.0 (Visual Studio 2013) code, and I get correct response, but when I analyze my C# 6.0 (Visual Studio 2015) code, StyleCop raises an exception for my rules. Now my question is: Is StyleCop 4.7 compatible with C# 6.0 code? If not, do we have any solution? TL;DR - Yes. StyleCop 4.7 was updated to be compatible with C# 6 starting with 4.7.51 (Beta) released on 13th March 2016. There was a handover to new custodians back in January 2016, and a new version

C# StyleCop - Using “this.” prefix for base class members like current class members or not?

点点圈 提交于 2019-12-05 03:32:23
StyleCop has a rule about using "this." prefix to calling class members (SA1101). Is this rule holds true about a member (for example a method) of a class which is inherited from its base class. Example: class BaseClass { protected void F1() { ... } } class ChildClass : BaseClass { protected void F2() { ... } protected void F3() { this.F2(); // This is correct acording to SA1101 // F1 is a member of base class and if I dont put this prefix, stylecop will not show any message. this.F1(); // Is this correct? F1(); // Or this? } } I know this is just for better readability. The documentation for

Is it possible to run StyleCop on just 1 file in a project?

别等时光非礼了梦想. 提交于 2019-12-05 02:12:16
Is it possible to run StyleCop on just 1 file in a project? Yes, by selecting "Run StyleCop" from the context menu of the .cs file, not from the Tools menu or the project's context menu. http://cleartopartlycloudy.blogspot.com/2009/06/stylecop-with-single-file.html 来源: https://stackoverflow.com/questions/1887776/is-it-possible-to-run-stylecop-on-just-1-file-in-a-project

How to suppress a StyleCop warning of entire namespace files

二次信任 提交于 2019-12-04 23:10:15
I'm using Style Cop version 4.7. Global suppression don't work for every member of selected namespace. I have two files in the same namespace (StyleCopSample.Test). When I set suppress message in the first file, messages are suppressing only for this file, but the second file still gets a warnings. Content of the first file: [assembly: SuppressMessage("CSharp.DocumentationRules", "*", Scope = "Namespace", Target = "StyleCopSample.Test")] namespace StyleCopSample.Test { class TestFirst {} } Content of the second file: namespace StyleCopSample.Test { class TestSecond {} } I don't want to

StyleCop MS Build magic? Who is calling the StyleCop target?

左心房为你撑大大i 提交于 2019-12-04 20:41:16
问题 In our project files we are using StyleCop and are running it during the build process. We've modified our project files to include the StyleCop targets like so: <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" /> <Import Project="..\..\Tools\Microsoft\StyleCop\v4.3\Microsoft.StyleCop.targets" /> <!-- To modify your build process, add your task inside one of

Adding GNU GPL Licence to C# App [closed]

女生的网名这么多〃 提交于 2019-12-04 17:46:07
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 4 years ago . I know how to do this but I don't know is the StyleCop method true/working. Normally in StyleCop rules you must add this thing like this example to header (need to edit): //----------------------------------------------------------------------- // <copyright file="Widget.cs" company="Sprocket Enterprises"> // Copyright (c) Sprocket Enterprises. All rights reserved. // </copyright> //-----------------------------

Where is the Stylecop configuration file?

狂风中的少年 提交于 2019-12-04 15:32:12
问题 I've installed Stylecop via NuGet. I wish to disable some rules, and I know this can be done via a configuration file from what I've read. However, I can't find the file anywhere, and there seems to be little documentation describing where to create the file. How do I go about making the file? Edit : As this question still seems to be getting attention a couple of years later, I recommend using Roslyn Analyzer based StyleCop now. This has a few advantages: It's actually maintained and active.