English 中文(简体)
Checkstyle for C#?
原标题:

I m looking to find something along the lines of Checkstyle for Visual Studio. I ve recently started a new gig doing .NET work and realized that coding standards here are a bit lacking. While I m still a young guy and far from the most experienced developer I m trying to lead by example and get things going in the right direction.

I loved the ability to use Checkstyle with Eclipse and examine code before reviews so I d like to do the same thing with Visual Studio. Anyone have any good suggestions?

Another thing I d be somewhat interested in is a plug-in for SVN that disallows check-in until the main coding standards are met. I do not want people checking in busted code that s going to wind up in a code review.

Any suggestions at this point would be great.

最佳回答

Have you tried StyleCop?

Note: This s been moved to https://github.com/StyleCop

问题回答

Take a look at resharper.

We use StyleCop to enforce our coding standards. It is free and integrates nicely with Visual Studio

What you re looking for is called Static Code Analysis.

FxCop is one option. I think Resharper can check this kind of thing as well.

Here are some of the great tools you can use

FxCop is a code analysis tool that checks .NET managed code assemblies for conformance to the Microsoft .NET Framework Design Guidelines


ReSharper is a refactoring and productivity plugin by JetBrains that extends native functionality of Microsoft Visual Studio .NET 2003, 2005 and 2008.


StyleCop is a free static code analysis tool from Microsoft that checks C# code for conformance to StyleCop s recommended coding styles and a subset of Microsoft s .NET Framework Design Guidelines

ref: http://blogs.msdn.com/fxcop/

Have you had a chance to review StyleCop

If you are looking for a long term supported version, I would recommend to look to Roselyn analyzers. They are the native support for Static Code Analysis with pre-configured rules, custom configs, and allow extensions.

According to the docs: “.NET compiler platform (Roslyn) analyzers inspect your C# or Visual Basic code for code quality and style issues.”

https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签