Install and use RuboCop RSpec by default.
This commit is contained in:
parent
2901c36798
commit
da404fcb4e
@ -11,8 +11,6 @@
|
|||||||
#: If `--display-cop-names` is passed, include the RuboCop cop name for each
|
#: If `--display-cop-names` is passed, include the RuboCop cop name for each
|
||||||
#: violation in the output.
|
#: 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
|
#: Passing `--only-cops=`<cops> will check for violations of only the listed
|
||||||
#: RuboCop <cops>, while `--except-cops=`<cops> will skip checking 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.
|
#: <cops>. For either option <cops> should be a comma-separated list of cop names.
|
||||||
|
|||||||
@ -18,10 +18,12 @@ module Homebrew
|
|||||||
fix = options[:fix]
|
fix = options[:fix]
|
||||||
|
|
||||||
Homebrew.install_gem_setup_path! "rubocop", HOMEBREW_RUBOCOP_VERSION
|
Homebrew.install_gem_setup_path! "rubocop", HOMEBREW_RUBOCOP_VERSION
|
||||||
|
Homebrew.install_gem! "rubocop-rspec"
|
||||||
require "rubocop"
|
require "rubocop"
|
||||||
require "rubocops"
|
require "rubocops"
|
||||||
|
|
||||||
args = %w[
|
args = %w[
|
||||||
|
--require rubocop-rspec
|
||||||
--force-exclusion
|
--force-exclusion
|
||||||
]
|
]
|
||||||
if fix
|
if fix
|
||||||
@ -34,11 +36,6 @@ module Homebrew
|
|||||||
args += ["--extra-details", "--display-cop-names"]
|
args += ["--extra-details", "--display-cop-names"]
|
||||||
end
|
end
|
||||||
|
|
||||||
if ARGV.include?("--rspec")
|
|
||||||
Homebrew.install_gem! "rubocop-rspec"
|
|
||||||
args += %w[--require rubocop-rspec]
|
|
||||||
end
|
|
||||||
|
|
||||||
if options[:except_cops]
|
if options[:except_cops]
|
||||||
options[:except_cops].map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") }
|
options[:except_cops].map! { |cop| RuboCop::Cop::Cop.registry.qualified_cop_name(cop.to_s, "") }
|
||||||
cops_to_exclude = options[:except_cops].select do |cop|
|
cops_to_exclude = options[:except_cops].select do |cop|
|
||||||
@ -65,11 +62,7 @@ module Homebrew
|
|||||||
File.expand_path(file).start_with? HOMEBREW_LIBRARY_PATH
|
File.expand_path(file).start_with? HOMEBREW_LIBRARY_PATH
|
||||||
end
|
end
|
||||||
config_file = if files.nil? || has_non_formula
|
config_file = if files.nil? || has_non_formula
|
||||||
if ARGV.include?("--rspec")
|
|
||||||
HOMEBREW_LIBRARY_PATH/".rubocop-rspec.yml"
|
|
||||||
else
|
|
||||||
HOMEBREW_LIBRARY_PATH/".rubocop.yml"
|
HOMEBREW_LIBRARY_PATH/".rubocop.yml"
|
||||||
end
|
|
||||||
else
|
else
|
||||||
HOMEBREW_LIBRARY/".rubocop_audit.yml"
|
HOMEBREW_LIBRARY/".rubocop_audit.yml"
|
||||||
end
|
end
|
||||||
|
|||||||
@ -8,6 +8,7 @@ gem "rspec-its", require: false
|
|||||||
gem "rspec-retry", require: false
|
gem "rspec-retry", require: false
|
||||||
gem "rspec-wait", require: false
|
gem "rspec-wait", require: false
|
||||||
gem "rubocop", HOMEBREW_RUBOCOP_VERSION
|
gem "rubocop", HOMEBREW_RUBOCOP_VERSION
|
||||||
|
gem "rubocop-rspec", require: false
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
gem "ronn", require: false
|
gem "ronn", require: false
|
||||||
|
|||||||
@ -52,6 +52,8 @@ GEM
|
|||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (~> 1.0, >= 1.0.1)
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
||||||
|
rubocop-rspec (1.29.1)
|
||||||
|
rubocop (>= 0.58.0)
|
||||||
ruby-progressbar (1.10.0)
|
ruby-progressbar (1.10.0)
|
||||||
simplecov (0.16.1)
|
simplecov (0.16.1)
|
||||||
docile (~> 1.1)
|
docile (~> 1.1)
|
||||||
@ -73,6 +75,7 @@ DEPENDENCIES
|
|||||||
rspec-retry
|
rspec-retry
|
||||||
rspec-wait
|
rspec-wait
|
||||||
rubocop (= 0.59.1)
|
rubocop (= 0.59.1)
|
||||||
|
rubocop-rspec
|
||||||
simplecov
|
simplecov
|
||||||
|
|
||||||
BUNDLED WITH
|
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
|
If `--display-cop-names` is passed, include the RuboCop cop name for each
|
||||||
violation in the output.
|
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
|
Passing `--only-cops=``cops` will check for violations of only the listed
|
||||||
RuboCop `cops`, while `--except-cops=``cops` will skip checking 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.
|
`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\.
|
If \fB\-\-display\-cop\-names\fR is passed, include the RuboCop cop name for each violation in the output\.
|
||||||
.
|
.
|
||||||
.IP
|
.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\.
|
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
|
.IP
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user