FEATURE: allow skipping certain charts with a comment

FEATURE: allow skipping certain charts with a comment

can be used to avoid charting data, this is handy

for outliers that dominate visually

diff --git a/plugin.rb b/plugin.rb
index 6919eb8..46bca26 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -50,6 +50,7 @@ after_initialize do
     rows.each do |row|
       desc = nil
       bench_parsed = nil
+      skip_chart = false
 
       row.raw.each_line do |line|
         desc = line.strip if !desc && line.present?
@@ -58,6 +59,8 @@ after_initialize do
           bench_parsed = :single
         elsif line.match?(/on \d+ core/)
           bench_parsed = :multi
+        elsif line.include?("<!-- skip chart -->")
+          skip_chart = true
         elsif bench_parsed
           match = line.match(/(.*): (\S+)(.*)(op\/s|seconds)$/)
           if match
@@ -71,7 +74,8 @@ after_initialize do
                 post_number: row.post_number,
                 description: desc,
                 variance: (match[3] || "").strip,
-                username: row.username
+                username: row.username,
+                skip_chart: skip_chart
               }
             end
           end
@@ -99,9 +103,11 @@ after_initialize do
       end
 
       metrics.each do |row|
-        markdown << <<~MD
-          #{row[:description]} | #{row[:duration]}
-        MD
+        if !row[:skip_chart]
+          markdown << <<~MD
+            #{row[:description]} | #{row[:duration]}
+          MD
+        end
       end
 
       markdown << "[/chart]\n\n"

GitHub sha: bd96f4ab

1 Like