diff --git a/Library/Homebrew/cask/cmd/style.rb b/Library/Homebrew/cask/cmd/style.rb index 1ea8fc8a4c0c686028ad53ac2025c9be38f19469..4ee00422a277b0d0d6003ab091e6c5456a68baca 100644 --- a/Library/Homebrew/cask/cmd/style.rb +++ b/Library/Homebrew/cask/cmd/style.rb @@ -20,7 +20,7 @@ module Cask def install_rubocop capture_stderr do begin - Homebrew.install_gem_setup_path! "rubocop-cask", HOMEBREW_RUBOCOP_CASK_VERSION, "rubocop" + Homebrew.install_gem_setup_path! "rubocop" rescue SystemExit raise CaskError, Tty.strip_ansi($stderr.string).chomp.sub(/\AError: /, "") end @@ -43,8 +43,8 @@ module Cask def default_args [ - "--require", "rubocop-cask", - "--force-default-config", + "--force-exclusion", + "--config", "#{HOMEBREW_LIBRARY}/.rubocop.yml", "--format", "simple" ] end diff --git a/Library/Homebrew/constants.rb b/Library/Homebrew/constants.rb deleted file mode 100644 index 3e1e748d851e65f62db6a72536cdc1107a94f960..0000000000000000000000000000000000000000 --- a/Library/Homebrew/constants.rb +++ /dev/null @@ -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 diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index 041ec86b944a167e6715f4d1a458ccc4f04efcd3..e47f01eec6cf6e4131e08533ceaf5368c5da5bbd 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -151,7 +151,6 @@ require "active_support/core_ext/object/blank" require "active_support/core_ext/hash/deep_merge" require "active_support/core_ext/file/atomic" -require "constants" require "exceptions" require "utils" diff --git a/Library/Homebrew/manpages/brew-cask.1.md b/Library/Homebrew/manpages/brew-cask.1.md index a5d78c34beb6be7e388109ae310155d28025bfcb..b0eb087a2413564d82d86a24d1e5471231de7816 100644 --- a/Library/Homebrew/manpages/brew-cask.1.md +++ b/Library/Homebrew/manpages/brew-cask.1.md @@ -104,7 +104,7 @@ graphical user interface. Ruby regular expression. * `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. With `--fix`, auto-correct any style errors if possible. diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index 60198886daf8944708db6e93d4ac1f6f7a67b9e7..3d46a6b005be9a25c5d0350a50a19af548c3c5cf 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -17,7 +17,7 @@ module Homebrew def check_style_impl(files, output_type, options = {}) fix = options[:fix] - Homebrew.install_gem_setup_path! "rubocop", HOMEBREW_RUBOCOP_VERSION + Homebrew.install_gem_setup_path! "rubocop" Homebrew.install_gem! "rubocop-rspec" require "rubocop" require "rubocops" @@ -80,11 +80,11 @@ module Homebrew args << "--debug" if ARGV.debug? args << "--display-cop-names" if ARGV.include? "--display-cop-names" args << "--format" << "simple" if files - system(cache_env, "rubocop", "_#{HOMEBREW_RUBOCOP_VERSION}_", *args) + system(cache_env, "rubocop", *args) rubocop_success = $CHILD_STATUS.success? when :json json, err, status = - Open3.capture3(cache_env, "rubocop", "_#{HOMEBREW_RUBOCOP_VERSION}_", + Open3.capture3(cache_env, "rubocop", "--format", "json", *args) # exit status of 1 just means violations were found; other numbers mean # execution errors. diff --git a/Library/Homebrew/test/Gemfile b/Library/Homebrew/test/Gemfile index 74f7fe4225d06e59b863c0f02b1e77f316fbe1c2..dae754c27b6839785464a7d0a6f2f739c173af56 100644 --- a/Library/Homebrew/test/Gemfile +++ b/Library/Homebrew/test/Gemfile @@ -1,13 +1,11 @@ source "https://rubygems.org" -require_relative "../constants" - gem "parallel_tests" gem "rspec" gem "rspec-its", require: false gem "rspec-retry", require: false gem "rspec-wait", require: false -gem "rubocop", HOMEBREW_RUBOCOP_VERSION +gem "rubocop" group :development do gem "ronn", require: false diff --git a/Library/Homebrew/test/Gemfile.lock b/Library/Homebrew/test/Gemfile.lock index b1c19e09b98b8de210bb50b0ae71ef8c2a3961f4..f8c0e6642ac88bbaf474a66ba69407ceef9a5dd7 100644 --- a/Library/Homebrew/test/Gemfile.lock +++ b/Library/Homebrew/test/Gemfile.lock @@ -74,7 +74,7 @@ DEPENDENCIES rspec-its rspec-retry rspec-wait - rubocop (= 0.60.0) + rubocop simplecov simplecov-cobertura diff --git a/Library/Homebrew/test/cask/cmd/style_spec.rb b/Library/Homebrew/test/cask/cmd/style_spec.rb index 8feea7a4d487511b537b7be72fac15f9c1e879f1..64c5a68bcb2dc8ad1310323a38afc9c80155994f 100644 --- a/Library/Homebrew/test/cask/cmd/style_spec.rb +++ b/Library/Homebrew/test/cask/cmd/style_spec.rb @@ -59,21 +59,6 @@ describe Cask::Cmd::Style, :cask do expect { subject }.to raise_error(Cask::CaskError) 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 describe "#cask_paths" do @@ -150,7 +135,7 @@ describe Cask::Cmd::Style, :cask do describe "#default_args" do subject { cli.default_args } - it { is_expected.to include("--require", "rubocop-cask", "--format", "simple") } + it { is_expected.to include("--format", "simple") } end describe "#autocorrect_args" do diff --git a/manpages/brew-cask.1 b/manpages/brew-cask.1 index 54512eb9029f03f8f25ae7e301f84689c8877a26..eec529273204b5d9f2343e269c34bf43a7e91137 100644 --- a/manpages/brew-cask.1 +++ b/manpages/brew-cask.1 @@ -104,7 +104,7 @@ Without an argument, display all locally available Casks for install; no online . .TP \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 \fBuninstall\fR or \fBrm\fR or \fBremove\fR [\-\-force] \fItoken\fR [ \fItoken\fR \.\.\. ]