mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[bundler/bundler] Check for straneous quotes
And use single quotes consistenly. https://github.com/bundler/bundler/commit/8b9fbbb2df
This commit is contained in:
parent
4dea1356c3
commit
e84e63230b
2 changed files with 26 additions and 1 deletions
|
@ -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 -%>
|
||||
|
|
|
@ -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 = []
|
||||
|
|
Loading…
Add table
Reference in a new issue