mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Avoid double parentheses for eg. (path/here/).rmtree
corrections
This commit is contained in:
parent
7404735654
commit
0872966c27
@ -46,8 +46,8 @@ module RuboCop
|
|||||||
else
|
else
|
||||||
node.arguments.first.source
|
node.arguments.first.source
|
||||||
end
|
end
|
||||||
|
args = "(#{args})" unless args.start_with?("(")
|
||||||
corrector.replace(node.loc.expression, "#{class_name}#{new_method}(#{args})")
|
corrector.replace(node.loc.expression, "#{class_name}#{new_method}#{args}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -64,6 +64,8 @@ RSpec.describe RuboCop::Cop::Homebrew::NoFileutilsRmrf do
|
|||||||
end
|
end
|
||||||
buildpath.rmtree
|
buildpath.rmtree
|
||||||
^^^^^^^^^^^^^^^^ Homebrew/NoFileutilsRmrf: #{RuboCop::Cop::Homebrew::NoFileutilsRmrf::MSG}
|
^^^^^^^^^^^^^^^^ Homebrew/NoFileutilsRmrf: #{RuboCop::Cop::Homebrew::NoFileutilsRmrf::MSG}
|
||||||
|
(path/"here").rmtree
|
||||||
|
^^^^^^^^^^^^^^^^^^^^ Homebrew/NoFileutilsRmrf: #{RuboCop::Cop::Homebrew::NoFileutilsRmrf::MSG}
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -76,6 +78,7 @@ RSpec.describe RuboCop::Cop::Homebrew::NoFileutilsRmrf do
|
|||||||
Pathname("path/to/yet/another/directory")
|
Pathname("path/to/yet/another/directory")
|
||||||
end
|
end
|
||||||
buildpath.rmtree
|
buildpath.rmtree
|
||||||
|
(path/"here").rmtree
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
expect(corrected).to eq(<<~RUBY)
|
expect(corrected).to eq(<<~RUBY)
|
||||||
@ -86,6 +89,7 @@ RSpec.describe RuboCop::Cop::Homebrew::NoFileutilsRmrf do
|
|||||||
Pathname("path/to/yet/another/directory")
|
Pathname("path/to/yet/another/directory")
|
||||||
end
|
end
|
||||||
FileUtils.rm_r(buildpath)
|
FileUtils.rm_r(buildpath)
|
||||||
|
FileUtils.rm_r(path/"here")
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user