From a3b4ea0443becbe55eb4a86eeb09e146edf4ebf3 Mon Sep 17 00:00:00 2001 From: Mike McQuaid <mike@mikemcquaid.com> Date: Thu, 6 Aug 2020 09:43:02 +0100 Subject: [PATCH] audit: add --tap argument. This allows auditing a single tap (so is useful for `test-bot`). --- Library/Homebrew/dev-cmd/audit.rb | 14 +++++++++++--- docs/Manpage.md | 6 ++++-- manpages/brew.1 | 8 ++++++-- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index bc3cc84a5f..45b24c293d 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -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 diff --git a/docs/Manpage.md b/docs/Manpage.md index 0cfe7f9602..268f8bd324 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -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. diff --git a/manpages/brew.1 b/manpages/brew.1 index 3c878e3ef3..6d92a6b7e6 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -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 -- GitLab