betterwithage commited on
Commit
12afa5f
·
verified ·
1 Parent(s): d6c7015

yuyay licenseHygiene: word-boundary match (disclosed != closed)

Browse files

Signed-off-by: Stephen P. Lutar Jr. <stephenlutar2@gmail.com>

Files changed (1) hide show
  1. serve.py +3 -1
serve.py CHANGED
@@ -1876,7 +1876,9 @@ try:
1876
  score = 0.97 # neutral-honest default
1877
  why = "default (no declared score)"
1878
  if name == "licenseHygiene":
1879
- bad = [w for w in _YUYAY_BAD_LICENSES if w in t]
 
 
1880
  if bad:
1881
  score = 0.40
1882
  why = "non-permissive license token(s): " + ", ".join(bad)
 
1876
  score = 0.97 # neutral-honest default
1877
  why = "default (no declared score)"
1878
  if name == "licenseHygiene":
1879
+ import re as _yre
1880
+ # word-boundary match so 'disclosed' doesn't match 'closed'
1881
+ bad = [w for w in _YUYAY_BAD_LICENSES if _yre.search(r"\b"+_yre.escape(w)+r"\b", t)]
1882
  if bad:
1883
  score = 0.40
1884
  why = "non-permissive license token(s): " + ", ".join(bad)