Skip to content

Commit

Permalink
Install and use RuboCop RSpec by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcQuaid committed Sep 20, 2018
1 parent 2901c36 commit da404fc
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 17 deletions.
2 changes: 0 additions & 2 deletions Library/Homebrew/cmd/style.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 3 additions & 10 deletions Library/Homebrew/style.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ def check_style_impl(files, output_type, options = {})
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
Expand All @@ -34,11 +36,6 @@ def check_style_impl(files, output_type, options = {})
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|
Expand All @@ -65,11 +62,7 @@ def check_style_impl(files, output_type, options = {})
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
Expand Down
1 change: 1 addition & 0 deletions Library/Homebrew/test/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions Library/Homebrew/test/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -73,6 +75,7 @@ DEPENDENCIES
rspec-retry
rspec-wait
rubocop (= 0.59.1)
rubocop-rspec
simplecov

BUNDLED WITH
Expand Down
File renamed without changes.
2 changes: 0 additions & 2 deletions docs/Manpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 0 additions & 3 deletions manpages/brew.1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit da404fc

Please sign in to comment.