comments update
This commit is contained in:
@ -53,7 +53,6 @@ valid_fields = ('File', 'Title') + valid_properties + ('Note', 'Building')
|
||||
url_fields = ('Home', 'Media', 'Play', 'Download', 'Code repository')
|
||||
|
||||
valid_url_prefixes = ('http://', 'https://', 'git://', 'svn://', 'ftp://', 'bzr://')
|
||||
extended_valid_url_prefixes = valid_url_prefixes + ('@see-', '@not-', '?')
|
||||
|
||||
valid_building_properties = ('Build system', 'Build instruction')
|
||||
valid_building_fields = valid_building_properties + ('Note',)
|
||||
@ -61,6 +60,9 @@ valid_building_fields = valid_building_properties + ('Note',)
|
||||
# these are the only valid platforms currently (and must be given in this order)
|
||||
valid_platforms = ('Windows', 'Linux', 'macOS', 'Android', 'iOS', 'Web')
|
||||
|
||||
# these fields are not allowed to have comments
|
||||
fields_without_comments = ('Inspiration', 'Play', 'Download', 'Platform', 'Code dependency')
|
||||
|
||||
# at least one of these must be used for every entry, this gives the principal categories and the order of the categories
|
||||
recommended_keywords = (
|
||||
'action', 'arcade', 'adventure', 'visual novel', 'sports', 'platform', 'puzzle', 'role playing', 'simulation',
|
||||
|
@ -301,7 +301,7 @@ def check_and_process_entry(entry):
|
||||
if index == len(c.valid_fields): # must be valid fields and must be in the right order
|
||||
message += 'Field "{}" either misspelled or in wrong order\n'.format(field)
|
||||
|
||||
# order is fine we can convert to dictionary
|
||||
# order is fine we can convert now to dictionary
|
||||
d = {}
|
||||
for field, value in entry:
|
||||
if field in d:
|
||||
@ -336,6 +336,13 @@ def check_and_process_entry(entry):
|
||||
if canonical_file_name != file and canonical_file_name != file[:-5] + '.md':
|
||||
message += 'file name should be {}\n'.format(canonical_file_name)
|
||||
|
||||
# check that fields without comments have no comments, set to field without comment
|
||||
for field in c.fields_without_comments:
|
||||
if field in entry:
|
||||
content = entry[field]
|
||||
if any(item.has_comment() for item in content):
|
||||
message += 'field without comments {} has comment\n'.format(field)
|
||||
|
||||
# state must contain either beta or mature but not both
|
||||
state = entry['State']
|
||||
for t in state:
|
||||
@ -350,7 +357,7 @@ def check_and_process_entry(entry):
|
||||
for value in values:
|
||||
if value.value.startswith('<') and value.value.endswith('>'):
|
||||
value.value = value.value[1:-1]
|
||||
if not any(value.startswith(x) for x in c.extended_valid_url_prefixes):
|
||||
if not any(value.startswith(x) for x in c.valid_url_prefixes):
|
||||
message += 'URL "{}" in field "{}" does not start with a valid prefix'.format(value, field)
|
||||
|
||||
# github/gitlab repositories should end on .git and should start with https
|
||||
|
@ -112,6 +112,9 @@ class ValueWithComment:
|
||||
def is_empty(self):
|
||||
return self.value == ''
|
||||
|
||||
def has_comment(self):
|
||||
return self.comment is not None
|
||||
|
||||
def startswith(self, str):
|
||||
return self.value.startswith(str)
|
||||
|
||||
|
Reference in New Issue
Block a user