From 3a22aff1b6f1cba97cffcbe64ed063f863a5b61d Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 18 Oct 2016 16:10:36 +0200 Subject: [PATCH 1/2] Refactor `brew cask style` not to require `.rubocop.yml`. --- Library/Homebrew/cask/lib/hbc/cli/style.rb | 10 +++++----- Library/Homebrew/cask/spec/cask/cli/style_spec.rb | 6 +----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Library/Homebrew/cask/lib/hbc/cli/style.rb b/Library/Homebrew/cask/lib/hbc/cli/style.rb index c6a08671f5..068f89d74c 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/style.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/style.rb @@ -54,17 +54,17 @@ module Hbc end def default_args - ["--format", "simple", "--force-exclusion", "--config", rubocop_config] + [ + "--require", "rubocop-cask", + "--format", "simple", + "--force-exclusion" + ] end def autocorrect_args default_args + ["--auto-correct"] end - def rubocop_config - Hbc.default_tap.cask_dir.join(".rubocop.yml") - end - def fix? args.any? { |arg| arg =~ %r{--(fix|(auto-?)?correct)} } end diff --git a/Library/Homebrew/cask/spec/cask/cli/style_spec.rb b/Library/Homebrew/cask/spec/cask/cli/style_spec.rb index 74ff108148..dbd6970d52 100644 --- a/Library/Homebrew/cask/spec/cask/cli/style_spec.rb +++ b/Library/Homebrew/cask/spec/cask/cli/style_spec.rb @@ -175,12 +175,8 @@ describe Hbc::CLI::Style do describe "#default_args" do subject { cli.default_args } - let(:rubocop_config) { ".rubocop.yml" } - before do - allow(cli).to receive(:rubocop_config).and_return(rubocop_config) - end - it { is_expected.to include("--format", "simple", "--force-exclusion", "--config", rubocop_config) } + it { is_expected.to include("--require", "rubocop-cask", "--format", "simple", "--force-exclusion") } end describe "#autocorrect_args" do From 143c3ac5c83c2d3b5c597352f3a1a59bd721f962 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 18 Oct 2016 16:39:25 +0200 Subject: [PATCH 2/2] =?UTF-8?q?Force=20the=20use=20of=20`rubocop-cask`?= =?UTF-8?q?=E2=80=99s=20default=20configuration.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Homebrew/cask/lib/hbc/cli/style.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Homebrew/cask/lib/hbc/cli/style.rb b/Library/Homebrew/cask/lib/hbc/cli/style.rb index 068f89d74c..0dd4bc4742 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/style.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/style.rb @@ -56,6 +56,7 @@ module Hbc def default_args [ "--require", "rubocop-cask", + "--config", "/dev/null", # always use `rubocop-cask` default config "--format", "simple", "--force-exclusion" ]