Ignore zap trash stanzas with interpolation
- Interpolating the version into a path is a common pattern, but the interpolations trip up the alphabetization autocorrect quite spectacularly, so let's ignore them (for now?).
This commit is contained in:
parent
73b3ace77c
commit
f4754baa00
@ -18,7 +18,7 @@ module RuboCop
|
||||
end
|
||||
end
|
||||
|
||||
array.each_descendant(:str).each_cons(2) do |first, second|
|
||||
array.children.reject(&:dstr_type?).each_cons(2) do |first, second|
|
||||
next if first.source.downcase < second.source.downcase
|
||||
|
||||
add_offense(second, message: "The `zap trash` paths should be in alphabetical order") do |corrector|
|
||||
|
||||
@ -56,4 +56,17 @@ describe RuboCop::Cop::Cask::ArrayAlphabetization, :config do
|
||||
end
|
||||
CASK
|
||||
end
|
||||
|
||||
it "ignores zap trash paths that have interpolation" do
|
||||
expect_no_offenses(<<~CASK)
|
||||
cask "foo" do
|
||||
url "https://example.com/foo.zip"
|
||||
|
||||
zap trash: [
|
||||
"~/Library/Application Support/Foo",
|
||||
"~/Library/Application Support/Bar\#{version.major}",
|
||||
]
|
||||
end
|
||||
CASK
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user