mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-10 09:10:30 +03:00
lint: UpdateCheckData regex must match integers
This commit is contained in:
parent
e76aac414f
commit
551fca21b3
1 changed files with 14 additions and 0 deletions
|
|
@ -218,6 +218,8 @@ regex_checks = {
|
||||||
|
|
||||||
locale_pattern = re.compile(r"[a-z]{2,3}(-([A-Z][a-zA-Z]+|\d+|[a-z]+))*")
|
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):
|
def check_regexes(app):
|
||||||
for f, checks in regex_checks.items():
|
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)
|
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):
|
def check_vercode_operation(app):
|
||||||
if not app.VercodeOperation:
|
if not app.VercodeOperation:
|
||||||
return
|
return
|
||||||
|
|
@ -767,6 +780,7 @@ def main():
|
||||||
check_app_field_types,
|
check_app_field_types,
|
||||||
check_regexes,
|
check_regexes,
|
||||||
check_update_check_data_url,
|
check_update_check_data_url,
|
||||||
|
check_update_check_data_int,
|
||||||
check_vercode_operation,
|
check_vercode_operation,
|
||||||
check_ucm_tags,
|
check_ucm_tags,
|
||||||
check_char_limits,
|
check_char_limits,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue