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 1f5bf6d1 Show external count
1f5bf6d1 is described below
commit 1f5bf6d13ede0b0dcc856ca614a4989e763d005b
Author: Sebb <[email protected]>
AuthorDate: Fri Apr 29 15:14:54 2022 +0100
Show external count
---
lib/whimsy/sitestandards.rb | 4 ++--
tools/site-scan.rb | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/whimsy/sitestandards.rb b/lib/whimsy/sitestandards.rb
index b5fc1254..f6edf6f9 100644
--- a/lib/whimsy/sitestandards.rb
+++ b/lib/whimsy/sitestandards.rb
@@ -122,8 +122,8 @@ module SiteStandards
'resources' => { # Custom: resources not outside ASF
CHECK_TEXT => nil,
CHECK_CAPTURE => nil,
- CHECK_VALIDATE => %r{.}i,
- CHECK_TYPE => true,
+ CHECK_VALIDATE => %r{Found 0 external resources},
+ CHECK_TYPE => false,
CHECK_POLICY => 'https://privacy.apache.org/faq/committers.html',
CHECK_DOC => 'Websites must not link to externally hosted resources',
},
diff --git a/tools/site-scan.rb b/tools/site-scan.rb
index 1e6a766f..b519c3a5 100755
--- a/tools/site-scan.rb
+++ b/tools/site-scan.rb
@@ -152,8 +152,10 @@ def parse(id, site, name)
css_urls = doc.xpath('//link/@href').map(&:content).reject {|x|
ASFDOMAIN.asfurl? x}
img_urls = doc.xpath('//img/@src').map(&:content).reject {|x|
ASFDOMAIN.asfurl? x}
resources = js_urls.size + css_urls.size + img_urls.size
- data[:resources] = 'Found no external resources' if resources == 0
+ data[:resources] = "Found #{resources} external resources"
+ # TODO: does not find js references such as:
+ # ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
'http://www') + '.google-analytics.com/ga.js';
return data
end