aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2010-10-21 07:51:47 -0700
committerAdam Vandenberg2010-10-21 07:53:37 -0700
commit405613a0ef9d725b847c3d2228ef8b0d984de251 (patch)
tree764a405dbefdf79b1d676901d0a8c3b250b2f038 /Library
parentb82be5c8b0d3482da165d6ee8bbd0ddfce547695 (diff)
downloadbrew-405613a0ef9d725b847c3d2228ef8b0d984de251.tar.bz2
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.
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Contributions/examples/brew-audit.rb8
-rw-r--r--Library/Contributions/manpages/brew.1.md5
2 files changed, 11 insertions, 2 deletions
diff --git a/Library/Contributions/examples/brew-audit.rb b/Library/Contributions/examples/brew-audit.rb
index 54d53d903..7b527f59b 100755
--- a/Library/Contributions/examples/brew-audit.rb
+++ b/Library/Contributions/examples/brew-audit.rb
@@ -80,7 +80,7 @@ def audit_formula_text text
end
# No trailing whitespace, please
- if text =~ /[ ]+$/
+ if text =~ /(\t|[ ])+$/
problems << " * Trailing whitespace was found."
end
@@ -88,6 +88,12 @@ def audit_formula_text text
problems << " * Use \"if ARGV.build_head?\" instead"
end
+ if ARGV.include? "--warn"
+ if text =~ /^\t/
+ problems << " * Use spaces instead of tabs for indentation"
+ end
+ end
+
return problems
end
diff --git a/Library/Contributions/manpages/brew.1.md b/Library/Contributions/manpages/brew.1.md
index d595cc4f8..5751f7d00 100644
--- a/Library/Contributions/manpages/brew.1.md
+++ b/Library/Contributions/manpages/brew.1.md
@@ -188,10 +188,13 @@ to recognize `brew cmdname`.
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
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>:
Displays install options specific to <formula>.