Repository navigation
fix(submit): reject a standard license with a restriction tacked on - #207
jamesconwaydev merged 2 commits into
Conversation
jamesconwaydev
left a comment
There was a problem hiding this comment.
The patterns are careful, and running every fixture through them is exactly the test I'd have asked for. Two things before it goes in:
1. Dry-run it against the current list. A licence fail removes an entry straight away, with no 30-day warning, and the weekly health check runs this on all 454 entries. The new path only fires when GitHub's detection is NOASSERTION/NONE, which is the case for a handful of listed repos (postgres, perl5 and ruby all came in through the fallback). Could you run check_repo(..., "rot") with your own token for every listed entry whose GitHub licence is NOASSERTION, NONE or missing, and paste the result in the PR? Anything that passes on main but fails here needs a look before merge. Fetching the licence key in a GraphQL batch first keeps it to a few dozen calls.
2. "No commercial use" in README prose. The README ## License path reads free text, so no commercial use also hits "There are no commercial use restrictions". The same goes for commercial use … requires, as in "commercial use requires nothing more than the notice". Please skip a match when restriction, limit or fee follows within a few words, or when the requires-clause names attribution or the notice, and add a test for each phrasing.
Dry run against the current listI checked all 454 listed entries with First pass: 1 difference. After the fix: 30/30 identical to
README prose (review point 2)
597 tests pass. |
jamesconwaydev
left a comment
There was a problem hiding this comment.
That dry run paid for itself. MySQL would have been pulled on the next health check. The trademark rule is the right cut, and the controls that still fail are what convince me. Thanks.
A LICENSE that was the MIT text plus "you may not use this commercially" passed, because the phrase match only looked for MIT's own wording. Once a license file (by phrase, SPDX line or one-line name) or a README License section is recognised, it is now also checked for added restriction wording: may not be used commercially or sold, commercial use prohibited or needing a paid license, and personal/educational/non-commercial use only. A hit fails as "<ID> with an added restriction". The reason is a fixed string and never quotes the file, since it is posted publicly. The patterns stick to wording that restricts. A test checks that no canonical fixture trips them except CC BY-NC, which really does.
717a4c0 to
4557a10
Compare
What and why
Closes #42.
Licence detection matched a file by the licence's own phrases, so the MIT text plus "you may not use this commercially" read as MIT. Now, once a licence file is recognised (by phrase, SPDX line or the one-line
MIT),_detect_textalso checks the whole file for added restriction wording, and so does the README## Licensesection path. A hit fails with the existing non-OSI message: "This repo's license (MIT with an added restriction) isn't an open-source license, so it can't be listed." The reason is a fixed string built from the SPDX ID and never quotes the file, since bot comments are public.RESTRICTION_REonly catches wording that restricts:I first tried "any sentence with commercial and a negation", and it flagged GPL-3, AGPL, LGPL, Apache, EPL and Artistic, which all mention commercial use without limiting it. A new test runs every fixture through the check: all pass except CC BY-NC, which really does restrict, and isn't OSI anyway. The
[^.;]{0,40}gaps are bounded, the existing hostile-input tests are unchanged, and the full suite is ~2.5s.One gap: this only runs when GitHub's own detection comes up empty (
NOASSERTION/NONE). A modified MIT text normally lands there, since licensee won't match a changed text, so I left GitHub's positive answers alone.Checks
python3 -m unittest discover -s scripts -t .passes (595; the new tests fail onmain)npm --prefix site testpasses (if you touchedsite/)npx prettier --check .passesdata/entries.jsonby hand (submissions go through the form)