brew-audit - add check for tabs.

Add a new mode "brew audit --warn" that performs stricter checks
that might not need to be fixed.

Currently this includes a check for using tabs instead of spaces
for indentation; Homebrew style is "2-space indentation."

Documented this new switch.
This commit is contained in:
Adam Vandenberg 2010-10-21 07:51:47 -07:00
parent b82be5c8b0
commit 405613a0ef
3 changed files with 15 additions and 3 deletions

View File

@ -80,7 +80,7 @@ def audit_formula_text text
end end
# No trailing whitespace, please # No trailing whitespace, please
if text =~ /[ ]+$/ if text =~ /(\t|[ ])+$/
problems << " * Trailing whitespace was found." problems << " * Trailing whitespace was found."
end end
@ -88,6 +88,12 @@ def audit_formula_text text
problems << " * Use \"if ARGV.build_head?\" instead" problems << " * Use \"if ARGV.build_head?\" instead"
end end
if ARGV.include? "--warn"
if text =~ /^\t/
problems << " * Use spaces instead of tabs for indentation"
end
end
return problems return problems
end end

View File

@ -188,10 +188,13 @@ to recognize `brew cmdname`.
Some external commands are shipped with Homebrew, and enabled by default. Some external commands are shipped with Homebrew, and enabled by default.
* `audit`: * `audit [--warn]`:
Checks all formulae for Homebrew coding style violations. This should be Checks all formulae for Homebrew coding style violations. This should be
run before submitting a new formula for inclusion. run before submitting a new formula for inclusion.
If `--warn` is passed, performs additional stricter checks that may not need
to be fixed before submitting.
* `options` <formula>: * `options` <formula>:
Displays install options specific to <formula>. Displays install options specific to <formula>.

View File

@ -197,9 +197,12 @@ Homebrew allows external commands to be defined by putting a +x file named \fBbr
Some external commands are shipped with Homebrew, and enabled by default\. Some external commands are shipped with Homebrew, and enabled by default\.
. .
.TP .TP
\fBaudit\fR \fBaudit [\-\-warn]\fR
Checks all formulae for Homebrew coding style violations\. This should be run before submitting a new formula for inclusion\. Checks all formulae for Homebrew coding style violations\. This should be run before submitting a new formula for inclusion\.
. .
.IP
If \fB\-\-warn\fR is passed, performs additional stricter checks that may not need to be fixed before submitting\.
.
.TP .TP
\fBoptions\fR \fIformula\fR \fBoptions\fR \fIformula\fR
Displays install options specific to \fIformula\fR\. Displays install options specific to \fIformula\fR\.