diff --git a/Library/Homebrew/dev-cmd/style.rb b/Library/Homebrew/dev-cmd/style.rb index 7e2fcbf136..8e860911d1 100644 --- a/Library/Homebrew/dev-cmd/style.rb +++ b/Library/Homebrew/dev-cmd/style.rb @@ -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 list to check for violations of only the "\ "listed RuboCop cops." @@ -36,6 +40,7 @@ module Homebrew description: "Specify a comma-separated 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 diff --git a/docs/Manpage.md b/docs/Manpage.md index 4be8d59572..bbbdfc71a0 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1243,6 +1243,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`: diff --git a/manpages/brew.1 b/manpages/brew.1 index bd2ddc37af..df3bac4dc1 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1724,6 +1724,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\. .