Cleanup rubocop-cask references.

This commit is contained in:
Mike McQuaid 2018-11-07 15:41:46 +00:00
parent ec3e7b2ae5
commit 109e974c38
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
9 changed files with 11 additions and 34 deletions

View File

@ -20,7 +20,7 @@ module Cask
def install_rubocop def install_rubocop
capture_stderr do capture_stderr do
begin begin
Homebrew.install_gem_setup_path! "rubocop-cask", HOMEBREW_RUBOCOP_CASK_VERSION, "rubocop" Homebrew.install_gem_setup_path! "rubocop"
rescue SystemExit rescue SystemExit
raise CaskError, Tty.strip_ansi($stderr.string).chomp.sub(/\AError: /, "") raise CaskError, Tty.strip_ansi($stderr.string).chomp.sub(/\AError: /, "")
end end
@ -43,8 +43,8 @@ module Cask
def default_args def default_args
[ [
"--require", "rubocop-cask", "--force-exclusion",
"--force-default-config", "--config", "#{HOMEBREW_LIBRARY}/.rubocop.yml",
"--format", "simple" "--format", "simple"
] ]
end end

View File

@ -1,5 +0,0 @@
# frozen_string_literal: true
# RuboCop version used for `brew style` and `brew cask style`
HOMEBREW_RUBOCOP_VERSION = "0.60.0"
HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.23.0" # has to be updated when RuboCop version changes

View File

@ -151,7 +151,6 @@ require "active_support/core_ext/object/blank"
require "active_support/core_ext/hash/deep_merge" require "active_support/core_ext/hash/deep_merge"
require "active_support/core_ext/file/atomic" require "active_support/core_ext/file/atomic"
require "constants"
require "exceptions" require "exceptions"
require "utils" require "utils"

View File

@ -104,7 +104,7 @@ graphical user interface.
Ruby regular expression. Ruby regular expression.
* `style` [--fix] [ <token> ... ]: * `style` [--fix] [ <token> ... ]:
Check the given Casks for correct style using [RuboCop Cask](https://github.com/Homebrew/rubocop-cask). Check the given Casks for correct style using RuboCop (with custom Cask cops).
If no tokens are given on the command line, all Casks are checked. If no tokens are given on the command line, all Casks are checked.
With `--fix`, auto-correct any style errors if possible. With `--fix`, auto-correct any style errors if possible.

View File

@ -17,7 +17,7 @@ module Homebrew
def check_style_impl(files, output_type, options = {}) def check_style_impl(files, output_type, options = {})
fix = options[:fix] fix = options[:fix]
Homebrew.install_gem_setup_path! "rubocop", HOMEBREW_RUBOCOP_VERSION Homebrew.install_gem_setup_path! "rubocop"
Homebrew.install_gem! "rubocop-rspec" Homebrew.install_gem! "rubocop-rspec"
require "rubocop" require "rubocop"
require "rubocops" require "rubocops"
@ -80,11 +80,11 @@ module Homebrew
args << "--debug" if ARGV.debug? args << "--debug" if ARGV.debug?
args << "--display-cop-names" if ARGV.include? "--display-cop-names" args << "--display-cop-names" if ARGV.include? "--display-cop-names"
args << "--format" << "simple" if files args << "--format" << "simple" if files
system(cache_env, "rubocop", "_#{HOMEBREW_RUBOCOP_VERSION}_", *args) system(cache_env, "rubocop", *args)
rubocop_success = $CHILD_STATUS.success? rubocop_success = $CHILD_STATUS.success?
when :json when :json
json, err, status = json, err, status =
Open3.capture3(cache_env, "rubocop", "_#{HOMEBREW_RUBOCOP_VERSION}_", Open3.capture3(cache_env, "rubocop",
"--format", "json", *args) "--format", "json", *args)
# exit status of 1 just means violations were found; other numbers mean # exit status of 1 just means violations were found; other numbers mean
# execution errors. # execution errors.

View File

@ -1,13 +1,11 @@
source "https://rubygems.org" source "https://rubygems.org"
require_relative "../constants"
gem "parallel_tests" gem "parallel_tests"
gem "rspec" gem "rspec"
gem "rspec-its", require: false 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"
group :development do group :development do
gem "ronn", require: false gem "ronn", require: false

View File

@ -74,7 +74,7 @@ DEPENDENCIES
rspec-its rspec-its
rspec-retry rspec-retry
rspec-wait rspec-wait
rubocop (= 0.60.0) rubocop
simplecov simplecov
simplecov-cobertura simplecov-cobertura

View File

@ -59,21 +59,6 @@ describe Cask::Cmd::Style, :cask do
expect { subject }.to raise_error(Cask::CaskError) expect { subject }.to raise_error(Cask::CaskError)
end end
end end
specify "`rubocop-cask` supports `HOMEBREW_RUBOCOP_VERSION`", :needs_network do
stdout, status = Open3.capture2(
"gem", "dependency", "rubocop-cask",
"--version", HOMEBREW_RUBOCOP_CASK_VERSION, "--pipe", "--remote"
)
expect(status).to be_a_success
requirement = Gem::Requirement.new(stdout.scan(/rubocop --version '(.*)'/).flatten.first)
version = Gem::Version.new(HOMEBREW_RUBOCOP_VERSION)
expect(requirement).not_to be_none
expect(requirement).to be_satisfied_by(version)
end
end end
describe "#cask_paths" do describe "#cask_paths" do
@ -150,7 +135,7 @@ describe Cask::Cmd::Style, :cask do
describe "#default_args" do describe "#default_args" do
subject { cli.default_args } subject { cli.default_args }
it { is_expected.to include("--require", "rubocop-cask", "--format", "simple") } it { is_expected.to include("--format", "simple") }
end end
describe "#autocorrect_args" do describe "#autocorrect_args" do

View File

@ -104,7 +104,7 @@ Without an argument, display all locally available Casks for install; no online
. .
.TP .TP
\fBstyle\fR [\-\-fix] [ \fItoken\fR \.\.\. ] \fBstyle\fR [\-\-fix] [ \fItoken\fR \.\.\. ]
Check the given Casks for correct style using RuboCop Cask \fIhttps://github\.com/Homebrew/rubocop\-cask\fR\. If no tokens are given on the command line, all Casks are checked\. With \fB\-\-fix\fR, auto\-correct any style errors if possible\. Check the given Casks for correct style using RuboCop (with custom Cask cops)\. If no tokens are given on the command line, all Casks are checked\. With \fB\-\-fix\fR, auto\-correct any style errors if possible\.
. .
.TP .TP
\fBuninstall\fR or \fBrm\fR or \fBremove\fR [\-\-force] \fItoken\fR [ \fItoken\fR \.\.\. ] \fBuninstall\fR or \fBrm\fR or \fBremove\fR [\-\-force] \fItoken\fR [ \fItoken\fR \.\.\. ]