A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ruby/mspec/commit/4599bc195fb109f2a482a01c32a7d659518369ea below:

Add a simple tool to parse errors and failures output to add tags · ruby/mspec@4599bc1 · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+39

-0

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+39

-0

lines changed Original file line number Diff line number Diff line change

@@ -0,0 +1,39 @@

1 +

# Adds tags based on error and failures output (e.g., from a CI log),

2 +

# without running any spec code.

3 + 4 +

tags_dir = %w[

5 +

spec/tags

6 +

spec/tags/ruby

7 +

].find { |dir| Dir.exist?("#{dir}/language") }

8 +

abort 'Could not find tags directory' unless tags_dir

9 + 10 +

output = ARGF.readlines

11 +

# Remove leading "[exec] " from JRuby logs

12 +

output = output.map { |line| line.sub(/^\[exec\] /, '') }

13 + 14 +

NUMBER = /^\d+\)$/

15 +

ERROR_OR_FAILED = / (ERROR|FAILED)$/

16 +

SPEC_FILE = /^(\/.+_spec\.rb)\:\d+/

17 + 18 +

failures = output.slice_before(NUMBER).select { |number, error_line, *rest|

19 +

number =~ NUMBER and error_line =~ ERROR_OR_FAILED

20 +

}.each { |number, error_line, *rest|

21 +

description = error_line.match(ERROR_OR_FAILED).pre_match

22 + 23 +

spec_file = rest.find { |line| line =~ SPEC_FILE }

24 +

spec_file = spec_file[SPEC_FILE, 1]

25 +

prefix = spec_file.index('spec/ruby')

26 +

spec_file = spec_file[prefix..-1]

27 + 28 +

tags_file = spec_file.sub('spec/ruby/', "#{tags_dir}/").sub(/_spec\.rb$/, '_tags.txt')

29 + 30 +

dir = File.dirname(tags_file)

31 +

Dir.mkdir(dir) unless Dir.exist?(dir)

32 + 33 +

tag_line = "fails:#{description}"

34 +

unless File.exist?(tags_file) and File.readlines(tags_file, chomp: true).include?(tag_line)

35 +

File.open(tags_file, 'a') do |f|

36 +

f.puts tag_line

37 +

end

38 +

end

39 +

}

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4