Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 31 additions & 24 deletions validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,33 @@ def gen_pl_table(filename):
return tab_text


def unique_json_keys_check(plugin, displaynames, foldernames, repositories):

found = False
for name in displaynames :
if plugin["display-name"] == name :
post_error(f'{plugin["display-name"]}: non unique display-name entry')
found = True
if found == False:
displaynames.append(plugin["display-name"])

found = False
for folder in foldernames :
if plugin["folder-name"] == folder :
post_error(f'{plugin["folder-name"]}: non unique folder-name entry')
found = True
if found == False:
foldernames.append(plugin["folder-name"])

found = False
for repo in repositories :
if plugin["repository"] == repo :
post_error(f'{plugin["repository"]}: non unique repository entry')
found = True
if found == False:
repositories.append(plugin["repository"])


def parse(filename):
try:
schema = json.loads(open("pl.schema").read())
Expand Down Expand Up @@ -203,30 +230,10 @@ def parse(filename):
f'detected is {dll_version}, but the expected version is {version}.')
continue

# Check the uniqueness of the JSON folder name, the display name, and the repository
found = False
for name in displaynames:
if plugin["display-name"] == name:
post_error(f'{plugin["display-name"]}: non unique display-name entry.')
found = True
if not found:
displaynames.append(plugin["display-name"])

found = False
for folder in foldernames:
if plugin["folder-name"] == folder:
post_error(f'{plugin["folder-name"]}: non unique folder-name entry.')
found = True
if found == False:
foldernames.append(plugin["folder-name"])

found = False
for repo in repositories:
if plugin["repository"] == repo:
post_error(f'{plugin["repository"]}: non unique repository entry.')
found = True
if found == False:
repositories.append(plugin["repository"])

#check uniqueness of json folder-name, display-name and repository
unique_json_keys_check(plugin, displaynames, foldernames, repositories)



ARCHITECTURE_FILENAMES_MAPPING = {
Expand Down
Loading