diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb index 1f0d385dee..76d961a7fe 100644 --- a/Library/Homebrew/cmd/style.rb +++ b/Library/Homebrew/cmd/style.rb @@ -11,6 +11,8 @@ #: If `--display-cop-names` is passed, include the RuboCop cop name for each #: violation in the output. #: +#: If `--rspec` is passed, install and use the RuboCop RSpec gem. +#: #: Passing `--only-cops=` will check for violations of only the listed #: RuboCop , while `--except-cops=` will skip checking the listed #: . For either option should be a comma-separated list of cop names. @@ -83,6 +85,11 @@ module Homebrew args << "--parallel" end + if ARGV.include?("--rspec") + Homebrew.install_gem! "rubocop-rspec" + args += %w[--require rubocop-rspec] + end + if options[:except_cops] options[:except_cops].map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") } cops_to_exclude = options[:except_cops].select do |cop| diff --git a/docs/Manpage.md b/docs/Manpage.md index db6ff1cc7d..3479ec771d 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -436,6 +436,8 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note If `--display-cop-names` is passed, include the RuboCop cop name for each violation in the output. + If `--rspec` is passed, install and use the RuboCop RSpec gem. + Passing `--only-cops=``cops` will check for violations of only the listed RuboCop `cops`, while `--except-cops=``cops` will skip checking the listed `cops`. For either option `cops` should be a comma-separated list of cop names. diff --git a/manpages/brew.1 b/manpages/brew.1 index 7bea0765f4..ca8c6f5f14 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -446,6 +446,9 @@ If \fB\-\-fix\fR is passed, automatically fix style violations using RuboCop\'s If \fB\-\-display\-cop\-names\fR is passed, include the RuboCop cop name for each violation in the output\. . .IP +If \fB\-\-rspec\fR is passed, install and use the RuboCop RSpec gem\. +. +.IP Passing \fB\-\-only\-cops=\fR\fIcops\fR will check for violations of only the listed RuboCop \fIcops\fR, while \fB\-\-except\-cops=\fR\fIcops\fR will skip checking the listed \fIcops\fR\. For either option \fIcops\fR should be a comma\-separated list of cop names\. . .IP