This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 6e9c9c3e Rework Ruby warnings; strip blank lines
6e9c9c3e is described below

commit 6e9c9c3e30e89b7efdcc82be2f495d43f26bfb6d
Author: Sebb <[email protected]>
AuthorDate: Mon Jan 8 17:03:02 2024 +0000

    Rework Ruby warnings; strip blank lines
---
 www/status/monitors/public_json.rb | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/www/status/monitors/public_json.rb 
b/www/status/monitors/public_json.rb
index 30097e20..01b2d45f 100644
--- a/www/status/monitors/public_json.rb
+++ b/www/status/monitors/public_json.rb
@@ -48,10 +48,6 @@ def Monitor.public_json(previous_status)
       # Ignore Wunderbar logging for normal messages (may occur multiple times)
       contents.gsub!(/^(_INFO|_DEBUG) .*?\n+/, '')
 
-      # Ignore Ruby warnings, e.g.:
-      # /usr/lib/ruby/2.7.0/net/protocol.rb:66: warning: previous definition 
of ProtocRetryError was here
-      contents.gsub!(%r{^(/usr|/var|/srv/gems/)\S+\.rb:\d+: warning: .*?\n}, 
'')
-
       # diff -u output: (may have additional \n at end)
       if contents.gsub!(/^--- .*?\n\n?(\n|\Z)/m, '')
         status[name].merge! level: 'info', title: 'updated'
@@ -68,8 +64,9 @@ def Monitor.public_json(previous_status)
           title: "#{warnings.length} warnings"
       end
 
-      # Ruby warnings
-      if contents.gsub!(%r{^/(?:var|usr)/lib/\S+: (warning:.*?)\n+}, '')
+      # Ruby warnings, e.g.
+      # /usr/lib/ruby/2.7.0/net/protocol.rb:66: warning: previous definition 
of ProtocRetryError was here
+      if contents.gsub!(%r{^/(?:var|usr|/srv/gems)/lib/\S+: (warning:.*?)\n+}, 
'')
         status[name].merge! level: 'warning', data: $1
       end
 
@@ -85,6 +82,8 @@ def Monitor.public_json(previous_status)
           data: "Last updated: #{File.mtime(log).to_s} (more than 24 hours 
old)"
       end
 
+      contents.gsub!(%r{^\s+$} , '') # drop any remaining blank lines
+
       # Treat everything left as an error to be reported
       unless contents.empty?
         status[name].merge! level: 'danger', data: contents.split("\n")

Reply via email to