mirror of
https://github.com/f-droid/fdroidserver.git
synced 2026-01-29 17:51:50 -05:00
lint: enforce HTTPS on GitHub and GitLab pages
The always provide HTTPS, so let's enforce it.
This commit is contained in:
@@ -120,7 +120,11 @@ http_url_shorteners = [
|
||||
]
|
||||
|
||||
http_checks = https_enforcings + http_url_shorteners + [
|
||||
(re.compile(r'.*github\.com/[^/]+/[^/]+\.git'),
|
||||
(re.compile(r'^(?!https?://)[^/]+'),
|
||||
_("URL must start with https:// or http://")),
|
||||
(re.compile(r'^http://[^.]+\.(github|gitlab)\.io/'),
|
||||
_("URL must start with https://")),
|
||||
(re.compile(r'^https://(github|gitlab)\.com(/[^/]+){2,3}\.git'),
|
||||
_("Appending .git is not necessary")),
|
||||
(re.compile(r'^https://[^/]*(github|gitlab|bitbucket|rawgit)\.[a-zA-Z]+/([^/]+/){2,3}master/'),
|
||||
_("Use /HEAD instead of /master to point at a file in the default branch")),
|
||||
|
||||
@@ -101,8 +101,12 @@ class LintTest(unittest.TestCase):
|
||||
self.assertFalse(anywarns)
|
||||
|
||||
bad_urls = [
|
||||
'github.com/my/proj',
|
||||
'https://github.com/foo/bar.git',
|
||||
'https://gitlab.com/group/subgroup/project.git',
|
||||
'https://raw.githubusercontent.com/Seva-coder/Finder/master/ChangeLog.txt',
|
||||
'https://github.com/scoutant/blokish/blob/master/README.md#changelog',
|
||||
'http://htmlpreview.github.io/?https://github.com/my/project/blob/HEAD/index.html',
|
||||
]
|
||||
anywarns = False
|
||||
logging.debug('bad urls:')
|
||||
|
||||
Reference in New Issue
Block a user