mirror of
https://github.com/logos-messaging/packages.git
synced 2026-01-08 17:13:09 +00:00
Add support for aliases to package scanner.
This commit is contained in:
parent
31390d2009
commit
e7ca6b4556
@ -73,6 +73,12 @@ proc canFetchNimbleRepository(name: string, urlJson: JsonNode): bool =
|
|||||||
echo "W: Another error attempting to request: ", url
|
echo "W: Another error attempting to request: ", url
|
||||||
echo " Error was: ", getCurrentExceptionMsg()
|
echo " Error was: ", getCurrentExceptionMsg()
|
||||||
|
|
||||||
|
proc verifyAlias(pdata: JsonNode, result: var int) =
|
||||||
|
if not pdata.hasKey("name"):
|
||||||
|
echo "E: missing alias' package name"
|
||||||
|
result.inc()
|
||||||
|
|
||||||
|
# TODO: Verify that 'alias' points to a known package.
|
||||||
|
|
||||||
proc check(): int =
|
proc check(): int =
|
||||||
var
|
var
|
||||||
@ -88,45 +94,48 @@ proc check(): int =
|
|||||||
for pdata in pkg_list:
|
for pdata in pkg_list:
|
||||||
name = if pdata.hasKey("name"): pdata["name"].str else: nil
|
name = if pdata.hasKey("name"): pdata["name"].str else: nil
|
||||||
|
|
||||||
if name.isNil:
|
if pdata.hasKey("alias"):
|
||||||
echo "E: missing package name"
|
verifyAlias(pdata, result)
|
||||||
result.inc()
|
|
||||||
|
|
||||||
elif not pdata.hasKey("method"):
|
|
||||||
echo "E: ", name, " has no method"
|
|
||||||
result.inc()
|
|
||||||
|
|
||||||
elif not (pdata["method"].str in VCS_TYPES):
|
|
||||||
echo "E: ", name, " has an unknown method: ", pdata["method"].str
|
|
||||||
result.inc()
|
|
||||||
|
|
||||||
elif not pdata.hasKey("url"):
|
|
||||||
echo "E: ", name, " has no URL"
|
|
||||||
result.inc()
|
|
||||||
|
|
||||||
elif pdata.hasKey("web") and not canFetchNimbleRepository(name, pdata["web"]):
|
|
||||||
result.inc()
|
|
||||||
|
|
||||||
elif not pdata.hasKey("tags"):
|
|
||||||
echo "E: ", name, " has no tags"
|
|
||||||
result.inc()
|
|
||||||
|
|
||||||
elif not pdata.hasKey("description"):
|
|
||||||
echo "E: ", name, " has no description"
|
|
||||||
result.inc()
|
|
||||||
|
|
||||||
elif not pdata.hasKey("license"):
|
|
||||||
echo "E: ", name, " has no license"
|
|
||||||
result.inc()
|
|
||||||
|
|
||||||
elif pdata["url"].str.normalize.startsWith("git://github.com/"):
|
|
||||||
echo "E: ", name, " has an insecure git:// URL instead of https://"
|
|
||||||
result.inc()
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Other warnings should go here
|
if name.isNil:
|
||||||
if not (pdata["license"].str in LICENSES):
|
echo "E: missing package name"
|
||||||
echo "W: ", name, " has an unexpected license: ", pdata["license"]
|
result.inc()
|
||||||
|
|
||||||
|
elif not pdata.hasKey("method"):
|
||||||
|
echo "E: ", name, " has no method"
|
||||||
|
result.inc()
|
||||||
|
|
||||||
|
elif not (pdata["method"].str in VCS_TYPES):
|
||||||
|
echo "E: ", name, " has an unknown method: ", pdata["method"].str
|
||||||
|
result.inc()
|
||||||
|
|
||||||
|
elif not pdata.hasKey("url"):
|
||||||
|
echo "E: ", name, " has no URL"
|
||||||
|
result.inc()
|
||||||
|
|
||||||
|
elif pdata.hasKey("web") and not canFetchNimbleRepository(name, pdata["web"]):
|
||||||
|
result.inc()
|
||||||
|
|
||||||
|
elif not pdata.hasKey("tags"):
|
||||||
|
echo "E: ", name, " has no tags"
|
||||||
|
result.inc()
|
||||||
|
|
||||||
|
elif not pdata.hasKey("description"):
|
||||||
|
echo "E: ", name, " has no description"
|
||||||
|
result.inc()
|
||||||
|
|
||||||
|
elif not pdata.hasKey("license"):
|
||||||
|
echo "E: ", name, " has no license"
|
||||||
|
result.inc()
|
||||||
|
|
||||||
|
elif pdata["url"].str.normalize.startsWith("git://github.com/"):
|
||||||
|
echo "E: ", name, " has an insecure git:// URL instead of https://"
|
||||||
|
result.inc()
|
||||||
|
|
||||||
|
else:
|
||||||
|
# Other warnings should go here
|
||||||
|
if not (pdata["license"].str in LICENSES):
|
||||||
|
echo "W: ", name, " has an unexpected license: ", pdata["license"]
|
||||||
|
|
||||||
if name.normalize notin names:
|
if name.normalize notin names:
|
||||||
names.incl(name.normalize)
|
names.incl(name.normalize)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user