mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-02 09:10:11 +02:00
lint: don't trip up on projects with 'master' in the name
https://gitlab.com/fdroid/fdroiddata/merge_requests/5557#note_223283359
This commit is contained in:
parent
17f37414db
commit
17320c23f4
@ -122,7 +122,7 @@ http_url_shorteners = [
|
||||
http_checks = https_enforcings + http_url_shorteners + [
|
||||
(re.compile(r'.*github\.com/[^/]+/[^/]+\.git'),
|
||||
_("Appending .git is not necessary")),
|
||||
(re.compile(r'.*://[^/]*(github|gitlab|bitbucket|rawgit)[^/]*/([^/]+/){1,3}master'),
|
||||
(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")),
|
||||
]
|
||||
|
||||
|
@ -70,6 +70,49 @@ class LintTest(unittest.TestCase):
|
||||
logging.debug(warn)
|
||||
self.assertTrue(anywarns)
|
||||
|
||||
def test_source_urls(self):
|
||||
config = dict()
|
||||
fdroidserver.common.fill_config_defaults(config)
|
||||
fdroidserver.common.config = config
|
||||
fdroidserver.lint.config = config
|
||||
|
||||
app = {
|
||||
'Name': 'My App',
|
||||
'Summary': 'just a placeholder',
|
||||
'Description': 'This app does all sorts of useful stuff',
|
||||
}
|
||||
good_urls = [
|
||||
'https://github.com/Matteljay/mastermindy-android',
|
||||
'https://gitlab.com/origin/master',
|
||||
'https://gitlab.com/group/subgroup/masterthing',
|
||||
'https://raw.githubusercontent.com/Seva-coder/Finder/HEAD/ChangeLog.txt',
|
||||
'https://github.com/scoutant/blokish/blob/HEAD/README.md#changelog',
|
||||
'https://git.ieval.ro/?p=fonbot.git;a=blob;f=Changes;hb=HEAD',
|
||||
'https://htmlpreview.github.io/?https://github.com/YasuakiHonda/Maxima-on-Android-AS/blob/HEAD/app/src/main/assets/About_MoA/index.html',
|
||||
'',
|
||||
]
|
||||
|
||||
anywarns = False
|
||||
for url in good_urls:
|
||||
app['SourceCode'] = url
|
||||
for warn in fdroidserver.lint.check_regexes(app):
|
||||
anywarns = True
|
||||
logging.debug(warn)
|
||||
self.assertFalse(anywarns)
|
||||
|
||||
bad_urls = [
|
||||
'https://raw.githubusercontent.com/Seva-coder/Finder/master/ChangeLog.txt',
|
||||
'https://github.com/scoutant/blokish/blob/master/README.md#changelog',
|
||||
]
|
||||
anywarns = False
|
||||
logging.debug('bad urls:')
|
||||
for url in bad_urls:
|
||||
app['SourceCode'] = url
|
||||
for warn in fdroidserver.lint.check_regexes(app):
|
||||
anywarns = True
|
||||
logging.debug(warn)
|
||||
self.assertTrue(anywarns)
|
||||
|
||||
def test_check_app_field_types(self):
|
||||
config = dict()
|
||||
fdroidserver.common.fill_config_defaults(config)
|
||||
|
Loading…
Reference in New Issue
Block a user