StyleCop,优点/缺点
StyleCop 有用吗?它有什么优点或缺点?
我还下载了 StyleCop、Resharper StyleCop。
我正在使用 resharper,它有自己的编码标准,StyleCop 有自己的编码标准,我很困惑将使用哪些规则?
Is StyleCop useful, what are the advantages or disadvantages of it?
I have also downloaded StyleCop, Resharper StyleCop.
I am using resharper and it has its own coding standards and StyleCop has its own, I am confused which rules will be used?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现 StyleCop 对于在整个开发团队中保持一致性非常有用。 它不会提高代码的功能价值,但会提高易读性并消除协作环境中的许多细微差别。
至于有很多不适用的规则,我发现最好的方法就是在机器级别关闭那些你不想遵循的规则。 然后,您可以随时与其他人共享此配置文件,以使整个团队遵循同一组规则。
至于 ReSharper,规则中有一些交叉,但其主要目的是提高编码效率,而不是遵守一组格式规则。 另一件事是 ReSharper 是一个仅限 IDE 的工具,而 StyleCop 可以在 Visual Studio 之外与 msbuild 一起使用。 默认情况下,ReSharper 和 StyleCop 规则违规都会显示,因此您只需选择要遵守哪些规则以及要禁用哪些规则即可。
祝你好运!
I find StyleCop very useful to get consistency across a development team. It’s not going to improve the functional value of your code but it will improve legibility and remove a lot of the nuances you get in a collaborative environment.
As for having a lot of rules that are not applicable, I’ve found the best approach is just to turn off the ones you don’t want to follow at the machine level. You can then always share this configuration file with others in order to get the whole team working to the same set of rules.
As for ReSharper, there’s some crossover in the rules but it’s primary purpose is coding productivity as opposed to compliance to a set of formatting rules. The other thing is ReSharper is an IDE only tool whereas StyleCop can be used with msbuild outside of Visual Studio. Both ReSharper and StyleCop rule violations will be shown by default so you’ll just need to be selective in terms of which ones you want to adhere to and which ones you want to disable.
Good luck!
我发现 ReSharper 4.5 本身就非常好。 您可以下载 StyleCop for ReSharper 来获取两者。 然而,我发现我经常花更多时间配置 StyleCop 以忽略规则,而不是从中获得的价值。
I've found ReSharper 4.5 to be pretty good on its own. You can download StyleCop for ReSharper to get both. However, I've found that I often spend more time configuring StyleCop to ignore rules than the value I get from it.