fix: avoid self-matching and version-pin false positives in the export checks
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
# Pass --allow-unchecked only if you knowingly want to skip that check.
|
||||
#
|
||||
# Independently of the terms file, a given terms file also enables two pattern checks on the export: personal
|
||||
# e-mail addresses (anything that is not a documentation/placeholder address) and "@senkensha"-style hosts.
|
||||
# e-mail addresses (anything that is not a documentation/placeholder address) and organisation-specific hosts.
|
||||
set -euo pipefail
|
||||
|
||||
allow_unchecked=0
|
||||
@@ -61,7 +61,7 @@ if [ -n "$terms" ] && [ -f "$terms" ] && grep -q '[^[:space:]]' "$terms"; then
|
||||
fail=1
|
||||
fi
|
||||
# 2. personal e-mail addresses: any address that is not a documentation or no-reply placeholder
|
||||
email='[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)+'
|
||||
email='[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}'
|
||||
placeholder='@(example\.(com|org|net|invalid)|[A-Za-z0-9.-]*\.(example|invalid|test|localhost)|users\.noreply\.github\.com|noreply\.[A-Za-z0-9.-]+)$|:(noreply|no-reply)@'
|
||||
if hits="$(grep -rIoE "$email" "$out" --exclude-dir=node_modules --exclude=Cargo.lock --exclude=package-lock.json \
|
||||
| grep -vE "$placeholder" || true)"; [ -n "$hits" ]; then
|
||||
@@ -69,8 +69,9 @@ if [ -n "$terms" ] && [ -f "$terms" ] && grep -q '[^[:space:]]' "$terms"; then
|
||||
echo "$hits" | sort -u >&2
|
||||
fail=1
|
||||
fi
|
||||
# 3. "@senkensha"-style hosts (any host label containing the org name after an @ or in a URL)
|
||||
if hits="$(grep -rIiEl '@[A-Za-z0-9.-]*senkensha|https?://[A-Za-z0-9.-]*senkensha' "$out" --exclude-dir=node_modules || true)"; [ -n "$hits" ]; then
|
||||
# 3. organisation-specific hosts (any host label containing the org name after an @ or in a URL)
|
||||
org="sen""kensha" # split so that this script does not match itself
|
||||
if hits="$(grep -rIiEl "@[A-Za-z0-9.-]*$org|https?://[A-Za-z0-9.-]*$org" "$out" --exclude-dir=node_modules || true)"; [ -n "$hits" ]; then
|
||||
echo "organisation-specific hosts found in:" >&2
|
||||
echo "$hits" >&2
|
||||
fail=1
|
||||
|
||||
Reference in New Issue
Block a user