indent tool: cleaning up source code

NEW
Unassigned

Status

Firefox Build System
General
7 years ago
3 months ago

People

(Reporter: joey, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

7 years ago
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

Comment 3

7 years ago
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.
(Reporter)

Comment 4

7 years ago
(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/.

Updated

3 months ago
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.