From 424c0f9344a73b03f4eae38564d64dde3a2f9231 Mon Sep 17 00:00:00 2001 From: Johannes Lund Date: Thu, 10 Feb 2022 16:23:00 +0100 Subject: [PATCH 1/2] Add --markdown-output option to scripts/bors-stats.rb --- scripts/bors-stats.rb | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/scripts/bors-stats.rb b/scripts/bors-stats.rb index a94e08adfd3..ab5dfdfe753 100755 --- a/scripts/bors-stats.rb +++ b/scripts/bors-stats.rb @@ -61,6 +61,7 @@ class BorsStats < Thor :long_desc => "`--group #1 #2 #3` will replace #2 and #3 with #1." desc "list", "list all failures" + method_option :markdown_output, :type => :boolean, :required => false, :desc => "Create markdown links to issues" def list() comments = fetch_comments_with_options options @@ -84,7 +85,14 @@ def list() n = k[:n] title = tm.dig t, "title" title = title.nil? ? "" : title - puts (bold(n.to_s) + " times (" + bold(failure_rate(n, nTot)) + ") " + yellow(t) + " " + bold(title)) + + tag_str = + if options[:markdown_output] and is_issue? t + then "[" + t + "](https://github.com/input-output-hk/cardano-wallet/issues/" + t.delete_prefix("#") + ")" + else yellow t + end + + puts (bold(n.to_s) + " times (" + bold(failure_rate(n, nTot)) + ") " + tag_str + " " + bold(title)) end end @@ -664,6 +672,16 @@ def rewrite_tags(comments, title_map) end end +## +# >>> is_issue? "#0" +# true +# +## >>> is_issue? "0" +# false +def is_issue? t + true if t.start_with? "#" and Integer(t.delete_prefix "#") rescue false +end + ###################################################################### # ANSI color code helpers From 428f50b64608a23c2ef4d493e45df9e8d8b15c88 Mon Sep 17 00:00:00 2001 From: Johannes Lund Date: Thu, 10 Feb 2022 16:24:01 +0100 Subject: [PATCH 2/2] Count unclassified failures in scripts/bors-stats.rb --- scripts/bors-stats.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/bors-stats.rb b/scripts/bors-stats.rb index ab5dfdfe753..2659041214b 100755 --- a/scripts/bors-stats.rb +++ b/scripts/bors-stats.rb @@ -75,9 +75,13 @@ def list() nSucc = comments[:filtered].filter { |x| x.succeeded }.length nFailed = nTot - nSucc + # this logic could be moved to the `breakdown` function. + nFailedNoCause = comments[:filtered].filter { |c| (not c.succeeded) and c.causes.empty? }.length + puts "" puts "succeeded: " + (bold nSucc.to_s) + " failed: " + (bold nFailed.to_s) + " (" + (bold (failure_rate(nFailed, nTot))) + ") total: " + (bold nTot.to_s) puts "Excluding " + nExcluded.to_s + " #expected or #duplicate failures" + puts "Unclassified: " + (bold nFailedNoCause.to_s) + " (" + (bold (failure_rate(nFailedNoCause, nFailed))) + " of all failures)" puts "" puts "Broken down by tags/issues:" breakdown(comments[:filtered],tm).each do |k,v| @@ -154,7 +158,7 @@ def try_fetch_system(comment) # build. BorsComment = Struct.new(:url, :bodyText, :links, :createdAt, :tags, :succeeded) do def causes - self.tags.filter {|x| x.start_with? "#" } + self.tags.filter {|x| x != "hydra" and x != "buildkite" } # HACK; works for now end def pretty(showDetails = :auto)