diff options
author | David Rodríguez <[email protected]> | 2019-03-28 16:46:13 +0100 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2019-08-03 09:30:00 +0900 |
commit | e84e63230bd024b652451cb7d1a44b9d9e0449ae (patch) | |
tree | adb27c7325256e227e9c5b0c40bfc96962b4982e /spec/bundler/quality_spec.rb | |
parent | 4dea1356c3ea97e9d0e98b1fbca69b01a6df2647 (diff) |
[bundler/bundler] Check for straneous quotes
And use single quotes consistenly.
https://github.com/bundler/bundler/commit/8b9fbbb2df
Diffstat (limited to 'spec/bundler/quality_spec.rb')
-rw-r--r-- | spec/bundler/quality_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/bundler/quality_spec.rb b/spec/bundler/quality_spec.rb index 9db8baa4c0..ebe85d17d2 100644 --- a/spec/bundler/quality_spec.rb +++ b/spec/bundler/quality_spec.rb @@ -59,6 +59,18 @@ RSpec.describe "The library itself" do "#{filename} has spaces on the EOL on lines #{failing_lines.join(", ")}" end + def check_for_straneous_quotes(filename) + return if File.expand_path(filename) == __FILE__ + + failing_lines = [] + each_line(filename) do |line, number| + failing_lines << number + 1 if line =~ /’/ + end + + return if failing_lines.empty? + "#{filename} has an straneous quote on lines #{failing_lines.join(", ")}" + end + def check_for_expendable_words(filename) failing_line_message = [] useless_words = %w[ @@ -106,6 +118,19 @@ RSpec.describe "The library itself" do expect(error_messages.compact).to be_well_formed end + it "has no estraneous quotes" do + exempt = /vendor|vcr_cassettes|LICENSE|rbreadline\.diff/ + error_messages = [] + Dir.chdir(root) do + files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler` : `git ls-files -z` + files.split("\x0").each do |filename| + next if filename =~ exempt + error_messages << check_for_straneous_quotes(filename) + end + end + expect(error_messages.compact).to be_well_formed + end + it "does not include any leftover debugging or development mechanisms" do exempt = %r{quality_spec.rb|support/helpers|vcr_cassettes|\.md|\.ronn} error_messages = [] |