diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-10-23 01:42:18 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-11-08 09:04:28 +0900 |
commit | d8e0337d02476f53bd4e33ffa014c7bf41e8ab15 (patch) | |
tree | d20e392ccfea8dc907abd99bcaab7bbe0063cd98 | |
parent | e6e4b4884d42a228aa342758318e1621c2552b62 (diff) | |
download | ruby-d8e0337d02476f53bd4e33ffa014c7bf41e8ab15.tar.gz |
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.
-rw-r--r-- | spec/bundler/quality_spec.rb | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/spec/bundler/quality_spec.rb b/spec/bundler/quality_spec.rb index ee911699b3..6b010fe872 100644 --- a/spec/bundler/quality_spec.rb +++ b/spec/bundler/quality_spec.rb @@ -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? |