Skip to content
Snippets Groups Projects
Unverified Commit da404fcb authored by Mike McQuaid's avatar Mike McQuaid
Browse files

Install and use RuboCop RSpec by default.

parent 2901c367
No related branches found
No related tags found
No related merge requests found
......@@ -11,8 +11,6 @@
#: 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.
......
......@@ -18,10 +18,12 @@ module Homebrew
fix = options[:fix]
Homebrew.install_gem_setup_path! "rubocop", HOMEBREW_RUBOCOP_VERSION
Homebrew.install_gem! "rubocop-rspec"
require "rubocop"
require "rubocops"
args = %w[
--require rubocop-rspec
--force-exclusion
]
if fix
......@@ -34,11 +36,6 @@ module Homebrew
args += ["--extra-details", "--display-cop-names"]
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|
......@@ -65,11 +62,7 @@ module Homebrew
File.expand_path(file).start_with? HOMEBREW_LIBRARY_PATH
end
config_file = if files.nil? || has_non_formula
if ARGV.include?("--rspec")
HOMEBREW_LIBRARY_PATH/".rubocop-rspec.yml"
else
HOMEBREW_LIBRARY_PATH/".rubocop.yml"
end
HOMEBREW_LIBRARY_PATH/".rubocop.yml"
else
HOMEBREW_LIBRARY/".rubocop_audit.yml"
end
......
......@@ -8,6 +8,7 @@ gem "rspec-its", require: false
gem "rspec-retry", require: false
gem "rspec-wait", require: false
gem "rubocop", HOMEBREW_RUBOCOP_VERSION
gem "rubocop-rspec", require: false
group :development do
gem "ronn", require: false
......
......@@ -52,6 +52,8 @@ GEM
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
rubocop-rspec (1.29.1)
rubocop (>= 0.58.0)
ruby-progressbar (1.10.0)
simplecov (0.16.1)
docile (~> 1.1)
......@@ -73,6 +75,7 @@ DEPENDENCIES
rspec-retry
rspec-wait
rubocop (= 0.59.1)
rubocop-rspec
simplecov
BUNDLED WITH
......
......@@ -464,8 +464,6 @@ 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.
......
......@@ -425,9 +425,6 @@ 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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment