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 2ae97be3 Tweak reporting
2ae97be3 is described below

commit 2ae97be334e1157a7c7244a7d7f63d822557b415
Author: Sebb <[email protected]>
AuthorDate: Sat Nov 1 22:33:14 2025 +0000

    Tweak reporting
---
 lib/whimsy/sitestandards.rb | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lib/whimsy/sitestandards.rb b/lib/whimsy/sitestandards.rb
index 76215c38..169387f8 100644
--- a/lib/whimsy/sitestandards.rb
+++ b/lib/whimsy/sitestandards.rb
@@ -142,10 +142,10 @@ module SiteStandards
     },
 
     'csp_check' => { # Custom: CSP must follow standards
-      CHECK_TEXT => 'Non-default CSP',
+      CHECK_TEXT => %r{^OK},
       CHECK_CAPTURE => nil,
       CHECK_VALIDATE => %r{^OK},
-      CHECK_TYPE => 'message',
+      CHECK_TYPE => 'text',
       CHECK_POLICY => 'https://infra.apache.org/tools/csp.html',
       CHECK_DOC => 'Websites must not replace the default 
Content-Security-Policy',
     },
@@ -276,7 +276,8 @@ module SiteStandards
   def process_csp(sites)
     sites.each do |site, data|
       csp = data.fetch('csp', nil)
-      squashed = csp&.gsub(/ +/, ' ') # might be null
+      next if csp.nil?
+      squashed = csp.gsub(/ +/, ' ') # might be null
       m = DEFAULT_CSP_RE.match(squashed)
       if m # the syntax of the CSP appears to be OK
         extras = m.captures.uniq
@@ -290,8 +291,6 @@ module SiteStandards
         else
             data['csp_check'] = "Mixed Extras - should not happen: #{extras}"
         end
-      elsif csp == nil
-        data['csp_check'] = 'OK - no website yet'        
       elsif data['nonpmc'] and data['uri'] =~ 
%r{^https://(www\.)?apache\.org/} and squashed == WWW_CSP
         data['csp_check'] = 'OK'
       else # did not match

Reply via email to