This commit is contained in:
Benoit Daloze 2023-10-30 16:44:52 +01:00
Родитель 58d1fbcf3f
Коммит b09618e566
1 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -3,6 +3,8 @@
# Adds tags based on error and failures output (e.g., from a CI log),
# without running any spec code.
tag = ENV["TAG"] || "fails"
tags_dir = %w[
spec/tags
spec/tags/ruby
@ -30,9 +32,9 @@ output.slice_before(NUMBER).select { |number, *rest|
if spec_file
spec_file = spec_file[SPEC_FILE, 1] or raise
else
if error_line =~ /^(\w+)[#\.](\w+) /
module_method = error_line.split(' ', 2).first
file = "#{$1.downcase}/#{$2}_spec.rb"
if error_line =~ /^([\w:]+)[#\.](\w+) /
mod, method = $1, $2
file = "#{mod.downcase.gsub('::', '/')}/#{method}_spec.rb"
spec_file = ['spec/ruby/core', 'spec/ruby/library', *Dir.glob('spec/ruby/library/*')].find { |dir|
path = "#{dir}/#{file}"
break path if File.exist?(path)
@ -54,7 +56,7 @@ output.slice_before(NUMBER).select { |number, *rest|
dir = File.dirname(tags_file)
Dir.mkdir(dir) unless Dir.exist?(dir)
tag_line = "fails:#{description}"
tag_line = "#{tag}:#{description}"
lines = File.exist?(tags_file) ? File.readlines(tags_file, chomp: true) : []
unless lines.include?(tag_line)
puts tags_file