audit: add --tap argument.

This allows auditing a single tap (so is useful for `test-bot`).
This commit is contained in:
Mike McQuaid 2020-08-06 09:43:02 +01:00
parent ab9b15caeb
commit a3b4ea0443
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
3 changed files with 21 additions and 7 deletions

View File

@ -37,6 +37,8 @@ module Homebrew
description: "Run various additional style checks to determine if a new formula is eligible "\ description: "Run various additional style checks to determine if a new formula is eligible "\
"for Homebrew. This should be used when creating new formula and implies "\ "for Homebrew. This should be used when creating new formula and implies "\
"`--strict` and `--online`." "`--strict` and `--online`."
flag "--tap=",
description: "Check the formulae within the given tap, specified as <user>`/`<repo>."
switch "--fix", switch "--fix",
description: "Fix style violations automatically using RuboCop's auto-correct feature." description: "Fix style violations automatically using RuboCop's auto-correct feature."
switch "--display-cop-names", switch "--display-cop-names",
@ -46,7 +48,7 @@ module Homebrew
"make output easy to grep." "make output easy to grep."
switch "--skip-style", switch "--skip-style",
description: "Skip running non-RuboCop style checks. Useful if you plan on running "\ description: "Skip running non-RuboCop style checks. Useful if you plan on running "\
"`brew style` separately." "`brew style` separately. Default unless a formula is specified by name"
switch "-D", "--audit-debug", switch "-D", "--audit-debug",
description: "Enable debugging and profiling of audit methods." description: "Enable debugging and profiling of audit methods."
comma_array "--only", comma_array "--only",
@ -85,12 +87,18 @@ module Homebrew
strict = new_formula || args.strict? strict = new_formula || args.strict?
online = new_formula || args.online? online = new_formula || args.online?
git = args.git? git = args.git?
skip_style = args.skip_style? || args.no_named? skip_style = args.skip_style? || args.no_named? || args.tap
ENV.activate_extensions! ENV.activate_extensions!
ENV.setup_build_environment ENV.setup_build_environment
audit_formulae = args.no_named? ? Formula : args.resolved_formulae audit_formulae = if args.tap
Tap.fetch(args.tap).formula_names.map { |name| Formula[name] }
elsif args.no_named?
Formula
else
args.resolved_formulae
end
style_files = args.formulae_paths unless skip_style style_files = args.formulae_paths unless skip_style
only_cops = args.only_cops only_cops = args.only_cops

View File

@ -674,6 +674,8 @@ any errors are found.
Run additional, slower style checks that require a network connection. Run additional, slower style checks that require a network connection.
* `--new-formula`: * `--new-formula`:
Run various additional style checks to determine if a new formula is eligible for Homebrew. This should be used when creating new formula and implies `--strict` and `--online`. Run various additional style checks to determine if a new formula is eligible for Homebrew. This should be used when creating new formula and implies `--strict` and `--online`.
* `--tap`:
Check the formulae within the given tap, specified as *`user`*`/`*`repo`*.
* `--fix`: * `--fix`:
Fix style violations automatically using RuboCop's auto-correct feature. Fix style violations automatically using RuboCop's auto-correct feature.
* `--display-cop-names`: * `--display-cop-names`:
@ -681,7 +683,7 @@ any errors are found.
* `--display-filename`: * `--display-filename`:
Prefix every line of output with the file or formula name being audited, to make output easy to grep. Prefix every line of output with the file or formula name being audited, to make output easy to grep.
* `--skip-style`: * `--skip-style`:
Skip running non-RuboCop style checks. Useful if you plan on running `brew style` separately. Skip running non-RuboCop style checks. Useful if you plan on running `brew style` separately. Default unless a formula is specified by name
* `-D`, `--audit-debug`: * `-D`, `--audit-debug`:
Enable debugging and profiling of audit methods. Enable debugging and profiling of audit methods.
* `--only`: * `--only`:
@ -1211,7 +1213,7 @@ flags which will help find keg-only dependencies like `openssl`, `icu4c`, etc.
`install` won't output a `Brewfile.lock.json`. `install` won't output a `Brewfile.lock.json`.
* `--all`: * `--all`:
`list` all dependencies. `list` all dependencies.
* `--brews`: * `--formulae`:
`list` Homebrew dependencies. `list` Homebrew dependencies.
* `--casks`: * `--casks`:
`list` Homebrew Cask dependencies. `list` Homebrew Cask dependencies.

View File

@ -870,6 +870,10 @@ Run additional, slower style checks that require a network connection\.
Run various additional style checks to determine if a new formula is eligible for Homebrew\. This should be used when creating new formula and implies \fB\-\-strict\fR and \fB\-\-online\fR\. Run various additional style checks to determine if a new formula is eligible for Homebrew\. This should be used when creating new formula and implies \fB\-\-strict\fR and \fB\-\-online\fR\.
. .
.TP .TP
\fB\-\-tap\fR
Check the formulae within the given tap, specified as \fIuser\fR\fB/\fR\fIrepo\fR\.
.
.TP
\fB\-\-fix\fR \fB\-\-fix\fR
Fix style violations automatically using RuboCop\'s auto\-correct feature\. Fix style violations automatically using RuboCop\'s auto\-correct feature\.
. .
@ -883,7 +887,7 @@ Prefix every line of output with the file or formula name being audited, to make
. .
.TP .TP
\fB\-\-skip\-style\fR \fB\-\-skip\-style\fR
Skip running non\-RuboCop style checks\. Useful if you plan on running \fBbrew style\fR separately\. Skip running non\-RuboCop style checks\. Useful if you plan on running \fBbrew style\fR separately\. Default unless a formula is specified by name
. .
.TP .TP
\fB\-D\fR, \fB\-\-audit\-debug\fR \fB\-D\fR, \fB\-\-audit\-debug\fR
@ -1569,7 +1573,7 @@ Read the \fBBrewfile\fR from \fB~/\.Brewfile\fR\.
\fBlist\fR all dependencies\. \fBlist\fR all dependencies\.
. .
.TP .TP
\fB\-\-brews\fR \fB\-\-formulae\fR
\fBlist\fR Homebrew dependencies\. \fBlist\fR Homebrew dependencies\.
. .
.TP .TP