You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2021/08/26 10:53:04 UTC
[whimsy] branch master updated: Style fixes
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 447eb2e Style fixes
447eb2e is described below
commit 447eb2ef2dde5ee0cd28ed974300e929dfbe1dcf
Author: Sebb <se...@apache.org>
AuthorDate: Thu Aug 26 11:52:57 2021 +0100
Style fixes
---
tools/site-scan.rb | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/tools/site-scan.rb b/tools/site-scan.rb
index 0fc32ab..4aa8063 100755
--- a/tools/site-scan.rb
+++ b/tools/site-scan.rb
@@ -24,14 +24,14 @@ end
# be in an image or other commonly related node on websites
def getText(txt, node, match=/Apache Software Foundation/i)
parent = nil # debug to show where parent needed to be fetched
- if not txt =~ match # have we got all the text?
+ if txt !~ match # have we got all the text?
if node.parent.name == 'a' # e.g. whimsical. such parents don't have extra text.
newnode = node.parent.parent
else
newnode = node.parent
end
# ensure <br> is treated as a separator when extracting the combined text
- newnode.css('br').each{ |br| br.replace(" ") }
+ newnode.css('br').each { |br| br.replace(" ") }
txt = squash(newnode.text)
parent = true
end
@@ -103,7 +103,7 @@ def parse(id, site, name)
(a_href =~ SiteStandards::COMMON_CHECKS['license'][SiteStandards::CHECK_CAPTURE])
begin
data[:license] = uri + a_href
- rescue
+ rescue StandardError
data[:license] = a_href
end
end
@@ -112,7 +112,7 @@ def parse(id, site, name)
if a_text =~ SiteStandards::COMMON_CHECKS[check][SiteStandards::CHECK_CAPTURE]
begin
data[check.to_sym] = uri + a_href
- rescue
+ rescue StandardError
data[check.to_sym] = a_href
end
end
@@ -124,16 +124,17 @@ def parse(id, site, name)
next unless node.is_a?(Nokogiri::XML::Text)
txt = squash(node.text)
# allow override if phrase looks good
- if (txt =~ SiteStandards::COMMON_CHECKS['trademarks'][SiteStandards::CHECK_CAPTURE] and not data[:trademarks]) or txt =~/are trademarks of [Tt]he Apache Software/
+ if (txt =~ SiteStandards::COMMON_CHECKS['trademarks'][SiteStandards::CHECK_CAPTURE] and not data[:trademarks]) or
+ txt =~ /are trademarks of [Tt]he Apache Software/
t, p = getText(txt, node)
# drop previous text if it looks like Copyright sentence
- data[:trademarks] = t.sub(/^.*?Copyright .+? Foundation[.]?/,'').strip
+ data[:trademarks] = t.sub(/^.*?Copyright .+? Foundation[.]?/, '').strip
data[:tradeparent] = p if p
end
if txt =~ SiteStandards::COMMON_CHECKS['copyright'][SiteStandards::CHECK_CAPTURE]
t, p = getText(txt, node)
# drop text around the Copyright (or the symbol)
- data[:copyright] = t.sub(/^.*?((Copyright|©) .+? Foundation[.]?).*/,'\1').strip
+ data[:copyright] = t.sub(/^.*?((Copyright|©) .+? Foundation[.]?).*/, '\1').strip
data[:copyparent] = p if p
end
# Note we also check for incubator disclaimer (immaterial of tlp|podling)