diff options
author | James Wen (RochesterinNYC) <jrw2175@columbia.edu> | 2016-05-31 23:23:05 -0400 |
---|---|---|
committer | James Wen (RochesterinNYC) <jrw2175@columbia.edu> | 2016-05-31 23:23:05 -0400 |
commit | ebbfc57b74bb25de12ffd0692bb25ec6d6592e36 (patch) | |
tree | 6961a234779e837c1897dfd9fdca7e2661ad8f9b /spec/quality_spec.rb | |
parent | 6ce55fdff04480018e8130bc9ebdccb40be21f3a (diff) | |
download | bundler-ebbfc57b74bb25de12ffd0692bb25ec6d6592e36.tar.gz |
Create quality check for unresolved merge conflicts
Diffstat (limited to 'spec/quality_spec.rb')
-rw-r--r-- | spec/quality_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb index 043958a74d..36d081c4e4 100644 --- a/spec/quality_spec.rb +++ b/spec/quality_spec.rb @@ -35,6 +35,22 @@ describe "The library itself" do "#{filename} has debugging mechanisms (like binding.pry, sleep, debugger, rspec focusing, etc.) on lines #{failing_lines.join(", ")}" end + def check_for_git_merge_conflicts(filename) + merge_conflicts_regex = / + <<<<<<<| + =======| + >>>>>>> + /x + + failing_lines = [] + File.readlines(filename).each_with_index do |line, number| + failing_lines << number + 1 if line =~ merge_conflicts_regex + end + + return if failing_lines.empty? + "#{filename} has unresolved git merge conflicts on lines #{failing_lines.join(", ")}" + end + def check_for_tab_characters(filename) failing_lines = [] File.readlines(filename).each_with_index do |line, number| @@ -128,6 +144,18 @@ describe "The library itself" do expect(error_messages.compact).to be_well_formed end + it "does not include any unresolved merge conflicts" do + error_messages = [] + exempt = %r{lock/lockfile_spec|quality_spec} + Dir.chdir(File.expand_path("../", __FILE__)) do + `git ls-files -z`.split("\x0").each do |filename| + next if filename =~ exempt + error_messages << check_for_git_merge_conflicts(filename) + end + end + expect(error_messages.compact).to be_well_formed + end + it "maintains language quality of the documentation" do included = /ronn/ error_messages = [] |