From 3a22aff1b6f1cba97cffcbe64ed063f863a5b61d Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 18 Oct 2016 16:10:36 +0200 Subject: 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(-) (limited to 'Library') diff --git a/Library/Homebrew/cask/lib/hbc/cli/style.rb b/Library/Homebrew/cask/lib/hbc/cli/style.rb index c6a08671f..068f89d74 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 74ff10814..dbd6970d5 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 -- cgit v1.2.3 From 143c3ac5c83c2d3b5c597352f3a1a59bd721f962 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 18 Oct 2016 16:39:25 +0200 Subject: Force the use of `rubocop-cask`’s default configuration. --- Library/Homebrew/cask/lib/hbc/cli/style.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'Library') diff --git a/Library/Homebrew/cask/lib/hbc/cli/style.rb b/Library/Homebrew/cask/lib/hbc/cli/style.rb index 068f89d74..0dd4bc474 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" ] -- cgit v1.2.3