自动化代码审查和重构 [英] Automating code review and refactoring

查看:92
本文介绍了自动化代码审查和重构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用工具进行自动化代码审查和重构。



寻找符合这些要求的工具建议:


  1. 低学习曲线。

  2. 定位于C#(也许是VB.NET)。

  3. 让我们轻松添加或自定义规则并且了解整个CodeDOM)。

  4. 很好记录。

  5. 对不起,低汇率=)

手动代码审查仍然完成。但是该工具应该足够彻底,以便在高级开发人员进行手动审核之前捕获所有常见的嘘声。



如果您有故事要分享您所拥有的工具



编辑:
最后有一些时间来研究更多的建议。 StyleCop不与Visual Studio Express版本集成,这是我正在使用的。 ReSharper有比我所需要的更多的功能(这纯粹是为了自动化代码审查)。我会说,它不是一个非常集中的工具,我的目的(也是它的价格标签的原因)。
仍然在寻找其他建议(如果有)。



EDITDIT:
StyleCop不与Visual Studio Express集成,但仍然可以设置为运行作为在Visual Studio Express中构建的一部分。看起来像是现在最好的解决方案。

解决方案

由于你提到ReSharper,我建议调查共享代码样式功能,可在其中一个最新版本。这样,您可以让您的团队遵循相同的标准和编码风格,并让他们知道他们的代码。您可以在这里阅读更多:共享代码样式。



我也在一个项目中从Visual Studio运行FxCop作为后构建过程。



Microsoft的 StyleCop 是MSDN代码库上的另一个免费项目,可能值得一试:



系统有一些不错的功能,但你说便宜,所以我甚至不去那里)



我学到的任何这些过程最重要的是,开发团队需要明白为什么这是重要的,每个人都需要购买它,以使它成功。一个流氓开发者或承包商可以使整个事情混乱,然后团队的其他人可能会认为为什么还要麻烦。


I'm trying to do automated code review and refactoring with a tool. Something in the lines of FxCop or ReSharper.

Looking for tool suggestions that meet these requirements:

  1. Low learning curve.
  2. Targeted at C# (and maybe VB.NET).
  3. Let's me easily add or customize rules (and understands entire CodeDOM).
  4. Well documented.
  5. FREE or dirt cheap. Sorry, low exchange rate =)

Manual code reviews will still be done. But the tool should be thorough enough to catch all the common boo boos before a senior developer does the manual review.

If you have stories to share about the tools that you have used/are using then that would be great, too.

Thanks.

EDIT: Finally had some time to look into the suggestions more. StyleCop does NOT integrate with Visual Studio Express Edition which is what I'm using. ReSharper has a lot more features than what I require (which is purely to automate code reviews). I would say it's not a very focused tool for my purposes (and also the reason for it's price tag). Still looking for other suggestions if any.

EDITDIT: StyleCop does NOT integrate with Visual Studio Express but you can still set it up to run as part of your build in Visual Studio Express. Seems like the best solution for now.

解决方案

Since you mentioned ReSharper, I would recommend looking into the sharing code styles feature that is available in one of the latest versions. This way you can have your team following the same standards and coding styles and will let them know as they code. You can read more here: Sharing Code Styles.

I have also been on a project where we ran FxCop from Visual Studio as a post build process. You can set warnings and errors the way you want in FxCop and even fail the build if you would like.

Microsoft's StyleCop is another free project on MSDN Code gallery that may be worth checking out:

Team System has some nice features in it, but you said cheap so I'm not even going there :)

The most important thing I learned about any of these processes, is the dev team needs to understand why this is important and everybody needs to buy into it in order for it to be successful. One rogue developer or contractor can make the whole thing a mess and then the rest of the team may think why even bother.

这篇关于自动化代码审查和重构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆