[Chicago-talk] Question of preference

Elliot Shank chicago.pm at galumph.com
Fri Dec 14 06:23:56 PST 2007

Shawn Carroll wrote:
> Or that the SCM would use perltidy to put the code into the teams
> style upon checkin? 

Whatever you do, do not modify code that is being checked in.  Why?  Because, upon a successful check in, the code in the server has changed, but not your copy.  You'll have to refresh the code after the check in.

Now, assume that there's a bug in the check in code that actually mangles your code and causes bugs?  You've just checked in your good copy and you'll assume that the copy in the SCM server is good and blindly do a refresh of the code.  Whoops!  You've just lost your only copy of the good version of the code.

If you want enforcement of standards, have the server do non-destructive compliance tests.  If there's a bug in that and someone runs into problems checking in, you haven't lost code and can go an figure out what's wrong on the server.

Perl::Critic has a RequireTidyCode policy, so you could just do a P::C check and it will enforce your formatting standards along with the rest of the policy checks.  If you do this, ensure that you create a P::C profile that tells RequireTidyCode where your perltidy configuration is.

More information about the Chicago-talk mailing list