Allow public domain dedications

This commit is contained in:
Ms2ger 2024-10-31 15:57:16 +01:00 committed by Philip Chimento
parent 3468e6aa77
commit d0bda4d26f
1 changed files with 11 additions and 0 deletions

View File

@ -18,6 +18,14 @@ _LICENSE_PATTERN = re.compile(
r'// See LICENSE or https://github\.com/tc39/test262/blob/HEAD/LICENSE' + r'// See LICENSE or https://github\.com/tc39/test262/blob/HEAD/LICENSE' +
r')', re.IGNORECASE) r')', re.IGNORECASE)
_PD_PATTERN = re.compile(
r'/\*[\r\n]{1,2}' +
r' \* Any copyright is dedicated to the Public Domain.[\r\n]{1,2}' +
r' \* http://creativecommons.org/licenses/publicdomain/[\r\n]{1,2}' +
r' \*/[\r\n]{1,2}',
re.IGNORECASE
)
class CheckLicense(Check): class CheckLicense(Check):
'''Ensure tests declare valid license information.''' '''Ensure tests declare valid license information.'''
ID = 'LICENSE' ID = 'LICENSE'
@ -29,6 +37,9 @@ class CheckLicense(Check):
if meta and 'flags' in meta and 'generated' in meta['flags']: if meta and 'flags' in meta and 'generated' in meta['flags']:
return return
if _PD_PATTERN.search(source):
return
match = _LICENSE_PATTERN.search(source) match = _LICENSE_PATTERN.search(source)
if not match: if not match: