C# 的 Checkstyle?
我正在寻找类似于 Visual Studio 的 Checkstyle 的东西。我最近开始了一项新工作,从事 .NET 工作,并意识到这里的编码标准有点缺乏。虽然我还是个年轻人,距离最有经验的开发人员还很远,但我正在努力以身作则,让事情朝着正确的方向发展。
我喜欢在 Eclipse 中使用 Checkstyle 并在审阅之前检查代码的能力,因此我想使用 Visual Studio 做同样的事情。大家有什么好的建议吗?
我感兴趣的另一件事是 SVN 的插件,在满足主要编码标准之前不允许签入。我不希望人们签入将在代码审查中结束的损坏代码。
此时任何建议都会很棒。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
你尝试过StyleCop吗?
注意:已移至 https://github.com/StyleCop
Have you tried StyleCop?
Note: This's been moved to https://github.com/StyleCop
看看 resharper。
Take a look at resharper.
我们使用 StyleCop 来强制执行我们的编码标准。它是免费的并且与 Visual Studio 完美集成
We use StyleCop to enforce our coding standards. It is free and integrates nicely with Visual Studio
您正在寻找的内容称为静态代码分析。
FxCop 是一种选择。我认为 Resharper 也可以检查这种事情。
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.
以下是您可以使用的一些出色工具
FxCop 是一种代码分析工具,用于检查 .NET 托管代码程序集是否符合 Microsoft .NET Framework 设计指南
ReSharper 是 JetBrains 的重构和生产力插件,它扩展了 Microsoft Visual Studio .NET 2003、2005 和 2008 的本机功能。
< a href="http://code.msdn.microsoft.com/sourceanalysis/Release/ProjectReleases.aspx?ReleaseId=1425" rel="nofollow noreferrer">StyleCop 是免费的来自 Microsoft 的静态代码分析工具,用于检查 C# 代码是否符合 StyleCop 推荐的编码风格以及 Microsoft .NET Framework 设计指南的子集
参考:http://blogs.msdn.com/fxcop/
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/
您有机会回顾一下 StyleCop
Have you had a chance to review StyleCop
如果您正在寻找长期支持的版本,我建议您查看 Roselyn 分析器。它们是对静态代码分析的本机支持,具有预配置的规则、自定义配置和允许扩展。
根据文档:“.NET 编译器平台 (Roslyn) 分析器检查您的 C# 或 Visual Basic 代码是否存在代码质量和样式问题。”
https://learn.microsoft.com/en-us/ dotnet/基础知识/代码分析/概述
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