[sf-perl] automatic perltidy (was Re: Perlcritic startup.)
doom at kzsu.stanford.edu
Thu May 6 15:11:37 PDT 2010
Fred Moyer <fred at redhotpenguin.com> wrote:
> 3) This is somewhat off topic but when you have hooks in place for
> perlcritic, perltidy hooks often get added in too. Write a subversion
> wrapper which perltidies the code into a new file and checks that in.
> Code formatting should happen automatically.
Just up on perlsphere, Ovid is complaining about how he can never talk
anyone into setting things up that way:
Myself, I tend to like optional code formatting, so that it's *possible*
to use idiosyncratic formatting when that makes things clearer.
It'd be cool to have a compromise solution, like say, code gets
autoformatted on the first check-in, but later check-ins are left alone.
(And were I the boss, I might like to be able to quietly impose
automatic formatting only for certain members of the dev team...)
Side issue: wouldn't it be cool if we had diffs that didn't care so much
about whitespace? Perhaps even semantically-aware diffs? Then tab-wars
would get a lot less rancorous...
> If you have to run 'perltidy file.pl' or \ry in vim or
> perlnow-perltidy in emacs then you burn developer cycles (a small
> number but it adds up in the long term).
In emacs, I just use C-M-\ (indent-region) all the time myself: the
cperl-mode default works well enough I never feel the need to use
It is, of course, possible to set-up emacs to do an automatic perltidy
on the buffer when you save the file.
More information about the SanFrancisco-pm