perltidy

Max Kanat-Alexander mkanat at bugzilla.org
Wed Aug 2 00:55:03 UTC 2006


On Tue, 2006-08-01 at 16:59 -0700, Benton, Kevin wrote:
> I'm wondering how others in this list feel about changing our entrance
> criteria for new patches to include that the submitting developer
> should run perltidy on the code prior to submitting it.

	It's not such a bad idea. 

	I just ran perltidy on some of our existing files, though, and I don't
totally like the output in some cases. Of course, I ran a version that
must be older than the version you ran, because my version said that
some of the specified switches were invalid. (The latest version
available for Fedora Extras is 20031021.)

	For example, try running it on Bugzilla/Bug.pm and see what it outputs.
In a lot of cases, it really does improve the formatting. It also makes
a few mistakes in places, or changes the formatting in a way I don't
think is great. I'm sure these can be changed by the appropriate command
line, but I don't know them:

	* It adds spaces after parentheses, where we normally don't.

	* It adds comments like "# end unless (blah)" even to really short
blocks. It's nice for long blocks, but it's unnecessary for subs and
short blocks.

	* It reformats some $dbh-> statements in a really strange way. :-)

	* It violates perlstyle in that it puts the ending brace of a
multi-line "if" statement on the end of the statement, and not on the
next line aligned with the closing brace.

	It does a lot of other good reformatting, though. I picked
Bugzilla/Bug.pm on purpose because it has a lot of old code, and it
improved parts of it.

	-Max
-- 
http://www.everythingsolved.com/
Competent, Friendly Bugzilla Services. And Everything Else, too.




More information about the developers mailing list