1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-05 06:50:10 +01:00

lint: UpdateCheckData regex must match integers

This commit is contained in:
Jochen Sprickerhof 2022-11-04 19:18:31 +01:00
parent e76aac414f
commit 551fca21b3
No known key found for this signature in database
GPG Key ID: 5BFFDCC258E69433

View File

@ -218,6 +218,8 @@ regex_checks = {
locale_pattern = re.compile(r"[a-z]{2,3}(-([A-Z][a-zA-Z]+|\d+|[a-z]+))*")
versioncode_check_pattern = re.compile(r"(\\d|\[(0-9|\\d)_?(a-fA-F)?])[+]")
def check_regexes(app):
for f, checks in regex_checks.items():
@ -261,6 +263,17 @@ def check_update_check_data_url(app): # noqa: D403
yield _('UpdateCheckData must use HTTPS URL: {url}').format(url=url)
def check_update_check_data_int(app): # noqa: D403
"""UpdateCheckData regex must match integers."""
if app.UpdateCheckData:
urlcode, codeex, urlver, verex = app.UpdateCheckData.split('|')
# codeex can be empty as well
if codeex and not versioncode_check_pattern.search(codeex):
yield _(
f'UpdateCheckData must match the version code as integer (\\d or [0-9]): {codeex}'
)
def check_vercode_operation(app):
if not app.VercodeOperation:
return
@ -767,6 +780,7 @@ def main():
check_app_field_types,
check_regexes,
check_update_check_data_url,
check_update_check_data_int,
check_vercode_operation,
check_ucm_tags,
check_char_limits,