Skip to content

Commit

Permalink
Merge pull request #8231 from MikeMcQuaid/audit-tap
Browse files Browse the repository at this point in the history
audit: add --tap argument.
  • Loading branch information
MikeMcQuaid committed Aug 6, 2020
2 parents 6ea3fd0 + a3b4ea0 commit c761c04
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
14 changes: 11 additions & 3 deletions Library/Homebrew/dev-cmd/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def audit_args
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",
Expand All @@ -46,7 +48,7 @@ def audit_args
"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",
Expand Down Expand Up @@ -85,12 +87,18 @@ def audit
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
Expand Down
4 changes: 3 additions & 1 deletion docs/Manpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -680,14 +680,16 @@ 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`:
Include the RuboCop cop name for each violation in the output.
* `--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`:
Expand Down
6 changes: 5 additions & 1 deletion manpages/brew.1
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,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\.
.
Expand All @@ -895,7 +899,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
Expand Down

0 comments on commit c761c04

Please sign in to comment.