From e84e63230bd024b652451cb7d1a44b9d9e0449ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 28 Mar 2019 16:46:13 +0100 Subject: [PATCH] [bundler/bundler] Check for straneous quotes And use single quotes consistenly. https://github.com/bundler/bundler/commit/8b9fbbb2df --- lib/bundler/templates/newgem/README.md.tt | 2 +- spec/bundler/quality_spec.rb | 25 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/bundler/templates/newgem/README.md.tt b/lib/bundler/templates/newgem/README.md.tt index 22ddeaa91a..59218dd8ae 100644 --- a/lib/bundler/templates/newgem/README.md.tt +++ b/lib/bundler/templates/newgem/README.md.tt @@ -43,5 +43,5 @@ The gem is available as open source under the terms of the [MIT License](https:/ ## Code of Conduct -Everyone interacting in the <%= config[:constant_name] %> project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/master/CODE_OF_CONDUCT.md). +Everyone interacting in the <%= config[:constant_name] %> project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/master/CODE_OF_CONDUCT.md). <% end -%> 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 = []