Merge pull request #1317 from reitermarkus/refactor-rubocop-cask
Refactor `brew cask style` not to require `.rubocop.yml`.
This commit is contained in:
commit
d08f61a704
@ -54,17 +54,18 @@ module Hbc
|
|||||||
end
|
end
|
||||||
|
|
||||||
def default_args
|
def default_args
|
||||||
["--format", "simple", "--force-exclusion", "--config", rubocop_config]
|
[
|
||||||
|
"--require", "rubocop-cask",
|
||||||
|
"--config", "/dev/null", # always use `rubocop-cask` default config
|
||||||
|
"--format", "simple",
|
||||||
|
"--force-exclusion"
|
||||||
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
def autocorrect_args
|
def autocorrect_args
|
||||||
default_args + ["--auto-correct"]
|
default_args + ["--auto-correct"]
|
||||||
end
|
end
|
||||||
|
|
||||||
def rubocop_config
|
|
||||||
Hbc.default_tap.cask_dir.join(".rubocop.yml")
|
|
||||||
end
|
|
||||||
|
|
||||||
def fix?
|
def fix?
|
||||||
args.any? { |arg| arg =~ %r{--(fix|(auto-?)?correct)} }
|
args.any? { |arg| arg =~ %r{--(fix|(auto-?)?correct)} }
|
||||||
end
|
end
|
||||||
|
@ -175,12 +175,8 @@ describe Hbc::CLI::Style do
|
|||||||
|
|
||||||
describe "#default_args" do
|
describe "#default_args" do
|
||||||
subject { cli.default_args }
|
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
|
end
|
||||||
|
|
||||||
describe "#autocorrect_args" do
|
describe "#autocorrect_args" do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user