Ignore non-zap trash methods
This commit is contained in:
parent
b9f13fc35d
commit
fb124f92ed
@ -14,6 +14,8 @@ module RuboCop
|
||||
return if node.method_name != :zap
|
||||
|
||||
node.each_descendant(:pair).each do |pair|
|
||||
next if pair.children.select(&:sym_type?).map(&:value) != [:trash]
|
||||
|
||||
pair.each_descendant(:array).each do |array|
|
||||
if array.children.length == 1
|
||||
add_offense(array, message: SINGLE_MSG) do |corrector|
|
||||
|
||||
@ -77,4 +77,17 @@ describe RuboCop::Cop::Cask::ArrayAlphabetization, :config do
|
||||
end
|
||||
CASK
|
||||
end
|
||||
|
||||
it "ignores `zap` methods other than `trash`" do
|
||||
expect_no_offenses(<<~CASK)
|
||||
cask "foo" do
|
||||
url "https://example.com/foo.zip"
|
||||
|
||||
zap delete: [
|
||||
"~/Library/Application Support/Foo",
|
||||
"~/Library/Application Support/Bar",
|
||||
]
|
||||
end
|
||||
CASK
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user