style: add two options

This commit is contained in:
hyuraku 2020-12-13 23:05:08 +09:00
parent d5283a77b9
commit 4f0b7255ac
3 changed files with 21 additions and 1 deletions

View File

@ -29,6 +29,10 @@ module Homebrew
description: "Include the RuboCop cop name for each violation in the output."
switch "--reset-cache",
description: "Reset the RuboCop cache."
switch "--formula", "--formulae",
description: "Treat all named arguments as formulae."
switch "--cask", "--casks",
description: "Treat all named arguments as casks."
comma_array "--only-cops",
description: "Specify a comma-separated <cops> list to check for violations of only the "\
"listed RuboCop cops."
@ -36,6 +40,7 @@ module Homebrew
description: "Specify a comma-separated <cops> list to skip checking for violations of the "\
"listed RuboCop cops."
conflicts "--formula", "--cask"
conflicts "--only-cops", "--except-cops"
end
end
@ -43,10 +48,13 @@ module Homebrew
def style
args = style_args.parse
only = :formula if args.formula? && !args.cask?
only = :cask if args.cask? && !args.formula?
target = if args.no_named?
nil
else
args.named.to_paths
args.named.to_paths(only: only)
end
only_cops = args.only_cops

View File

@ -1233,6 +1233,10 @@ including core code and all formulae.
Include the RuboCop cop name for each violation in the output.
* `--reset-cache`:
Reset the RuboCop cache.
* `--formula`:
Treat all named arguments as formulae.
* `--cask`:
Treat all named arguments as casks.
* `--only-cops`:
Specify a comma-separated *`cops`* list to check for violations of only the listed RuboCop cops.
* `--except-cops`:

View File

@ -1708,6 +1708,14 @@ Include the RuboCop cop name for each violation in the output\.
Reset the RuboCop cache\.
.
.TP
\fB\-\-formula\fR
Treat all named arguments as formulae\.
.
.TP
\fB\-\-cask\fR
Treat all named arguments as casks\.
.
.TP
\fB\-\-only\-cops\fR
Specify a comma\-separated \fIcops\fR list to check for violations of only the listed RuboCop cops\.
.