Open Bug 688440 Opened 13 years ago Updated 2 years ago

indent tool: cleaning up source code

Categories

(Firefox Build System :: General, defect)

defect

Tracking

(Not tracked)

People

(Reporter: joey, Unassigned)

Details

Not entirely sure what category this one belongs in...

http://www.gnu.org/s/indent/
http://www.gnu.org/software/indent/manual/indent.html

It would be handy to have a tool like GNU indent configured/available, able to reformat code according to Mozilla's established coding guidelines.  Prior to code review or checkin the tool could be used to reformat sources, expand tabs, adjust braces, etc, etc, etc to resolve any simple/silly formatting problems.

# python flavor
http://pythonwise.blogspot.com/2009/09/pyindent.html

# perl - using emacs --batch
http://www.perlmonks.org/?node_id=39624

Use of a single tool for reformatting would be optimal but front end shell script could be used to bury details if more than one answer is needed.

2nd round of edits could involve repository commit hooks so reformatting would happen automagically.


Oh and if sources are being identified by extension other functionality could be added.  --lint for instance:
   .py -> invoke pylint on sources
   .pl/.pm:
       * http://www.xav.com/perl/lib/B/Lint.html
       * emacs --batch http://www.cpan.org/modules/by-module/LWP/JJORE/perl-lint-mode-0.02.readme
[ ... ]
This belongs in a Gecko product/component IMHO. Putting in Core: Build Config because I'm not sure where else to put it.
Component: Release Engineering → Build Config
Product: mozilla.org → Core
QA Contact: release → build-config
Version: other → unspecified
I'm not strictly opposed to this, but there are plenty of cases where readability trumps the normal rules, or where the rules produce odd results. Plus our codebase has several established patterns that we probably don't want to "fix". So we need to be careful to use this judiciously.
(In reply to Joey Armstrong [:joey] from comment #1)
> Style guide on MDN
> http://developer.mozilla.org/En/Mozilla_Coding_Style_Guide

Here is another lint/perl resource that someone suggested using this morning.
>> Gregory Szorc [:gps] 
>> I also recommend running Perl through Perl::Critic.
>> If you don't have that installed locally, go to http://perlcritic.com/.
Product: Core → Firefox Build System
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.