mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 21:44:30 +02:00
Escape the target string to be checked
Comparing file paths as strings may not work well for some reasons, symlink, relative `__FILE__`, etc. Some alternatives are possible: comparing with `File.realpath`, or with `File.identical?`, it should be most robust to escape the target string contained within this file itself.
This commit is contained in:
parent
e6e4b4884d
commit
d8e0337d02
1 changed files with 1 additions and 3 deletions
|
@ -41,11 +41,9 @@ RSpec.describe "The library itself" do
|
|||
end
|
||||
|
||||
def check_for_extraneous_quotes(filename)
|
||||
return if File.expand_path(filename) == __FILE__
|
||||
|
||||
failing_lines = []
|
||||
each_line(filename) do |line, number|
|
||||
failing_lines << number + 1 if /’/.match?(line)
|
||||
failing_lines << number + 1 if /\u{2019}/.match?(line)
|
||||
end
|
||||
|
||||
return if failing_lines.empty?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue