lint: require https:// and no shorteners in Donate: links

This commit is contained in:
Hans-Christoph Steiner
2025-11-24 15:18:53 +01:00
parent 4a1af27ab2
commit 34a6e2cfee
2 changed files with 16 additions and 1 deletions

View File

@@ -154,7 +154,8 @@ regex_checks = {
(re.compile(r'.*github\.com/[^/]+/[^/]+/*$'), _("/issues is missing")),
(re.compile(r'.*gitlab\.com/[^/]+/[^/]+/*$'), _("/issues is missing")),
],
'Donate': http_checks
'Donate': http_url_shorteners
+ require_https
+ [
(
re.compile(r'.*liberapay\.com'),

View File

@@ -177,6 +177,20 @@ class LintTest(SetUpTearDownMixin, unittest.TestCase):
logging.debug(warn)
self.assertTrue(anywarns, f"{url} does not fail lint!")
def test_check_regexes_donate(self):
app = fdroidserver.metadata.App()
app.Donate = 'https://example.com/donate/'
for warn in fdroidserver.lint.check_regexes(app):
self.fail()
def test_check_regexes_donate_both(self):
app = fdroidserver.metadata.App()
app.Donate = 'http://bit.ly/givememoney/'
warns = list(fdroidserver.lint.check_regexes(app))
for warn in warns:
self.assertIn('bit.ly', warn)
self.assertEqual(2, len(warns))
def test_check_regexes_binaries(self):
app = fdroidserver.metadata.App()
app.Binaries = 'https://example.com/%v.apk'