开发者

How to ensure quality checkins with continuous build systems?

开发者 https://www.devze.com 2022-12-20 22:35 出处:网络
I religiously go through all of my code before I check it in and do a diff of the before and after code and read through it and make sure I undersatnd the ch开发者_JAVA百科anges. Usually I end up havi

I religiously go through all of my code before I check it in and do a diff of the before and after code and read through it and make sure I undersatnd the ch开发者_JAVA百科anges. Usually I end up having to add comments, amend variable names, amend algorithms, amend code, retest things, discuss with other developers about their code, add new bugs/issues, but I very rarely end up doing the checkin immediately.

I do notice however that alot of developers these days seem to check their code in and think that when the build breaks that it is enough, then they go back and look at their changes. This is one of the things about continuous build systems that I definitely do not like, in that sometimes I think developers stop thinking about their code enough.

What best practices are there for ensuring only quality code goes into continuous build systems?


I do notice however that alot of developers these days seem to check their code in and think that when the build breaks that it is enough, then they go back and look at their changes.

In my opinion, using the continuous build for "verification" purpose is indeed a bad practice, developers should always try to not commit bad code that can affect the team and interrupt the work (the why is so obvious that if you don't get that, just look for another job). So, if your CI engine doesn't offer Pre-tested commit (like TeamCity, Team Foundation Server as I just saw, maybe Hudson one day, etc), you should always sync/build/sync (and rebuild if necessary) locally before to commit. Not doing this is laziness and not respectful of the team.

What best practices are there for ensuring only quality code goes into continuous build systems?

  • Just in case, remind why breaking the build is bad: bad code potentially affects the whole team and interrupts the work (sigh).
  • If you can get tool support (see the mentioned solutions above), get it.
  • If not, document the right workflow: 1. sync 2. build locally 3. sync 4. back to 2 if required 5. commit. Make this visible so that there is no excuses.
  • If this is an option, use something like (or similar to) the Hudson's Continuous Integration Game plugin. This can make things more fun.

I've seen people using a light financial "penalty" for broken build but I don't really like this idea. First, we should be able to behave as responsible adults. Second, the obtained result was that people started to delay commits (which at the end was the opposite of the expected benefit).


Team Foundation Server has something called pre checkin validation.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号