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 "\
"for Homebrew. This should be used when creating new formula and implies "\
"`--strict` and `--online`."
flag "--tap=",
description: "Check the formulae within the given tap, specified as <user>`/`<repo>."
switch "--fix",
description: "Fix style violations automatically using RuboCop's auto-correct feature."
switch "--display-cop-names",
@ -46,7 +48,7 @@ module Homebrew
"make output easy to grep."
switch "--skip-style",
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",
description: "Enable debugging and profiling of audit methods."
comma_array "--only",
@ -85,12 +87,18 @@ module Homebrew
strict = new_formula || args.strict?
online = new_formula || args.online?
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.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
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.
* `--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`.
* `--tap`:
Check the formulae within the given tap, specified as *`user`*`/`*`repo`*.
* `--fix`:
Fix style violations automatically using RuboCop's auto-correct feature.
* `--display-cop-names`:
@ -681,7 +683,7 @@ any errors are found.
* `--display-filename`:
Prefix every line of output with the file or formula name being audited, to make output easy to grep.
* `--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`:
Enable debugging and profiling of audit methods.
* `--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`.
* `--all`:
`list` all dependencies.
* `--brews`:
* `--formulae`:
`list` Homebrew dependencies.
* `--casks`:
`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\.
.
.TP
\fB\-\-tap\fR
Check the formulae within the given tap, specified as \fIuser\fR\fB/\fR\fIrepo\fR\.
.
.TP
\fB\-\-fix\fR
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
\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
\fB\-D\fR, \fB\-\-audit\-debug\fR
@ -1569,7 +1573,7 @@ Read the \fBBrewfile\fR from \fB~/\.Brewfile\fR\.
\fBlist\fR all dependencies\.
.
.TP
\fB\-\-brews\fR
\fB\-\-formulae\fR
\fBlist\fR Homebrew dependencies\.
.
.TP