mirror of
https://github.com/logos-messaging/packages.git
synced 2026-01-02 22:23:06 +00:00
parent
fc4a1761a5
commit
79a4452e1d
@ -25,7 +25,6 @@ import sets
|
||||
import strutils
|
||||
|
||||
const
|
||||
|
||||
LICENSES = @[
|
||||
"Allegro 4 Giftware",
|
||||
"Apache License 2.0",
|
||||
@ -47,7 +46,6 @@ const
|
||||
"ISC",
|
||||
"Unlicense"
|
||||
]
|
||||
|
||||
VCS_TYPES = @["git", "hg"]
|
||||
|
||||
proc canFetchNimbleRepository(name: string, urlJson: JsonNode): bool =
|
||||
@ -80,57 +78,43 @@ proc verifyAlias(pdata: JsonNode, result: var int) =
|
||||
# TODO: Verify that 'alias' points to a known package.
|
||||
|
||||
proc check(): int =
|
||||
var
|
||||
name: string
|
||||
|
||||
var name: string
|
||||
echo ""
|
||||
|
||||
let
|
||||
pkg_list = parseJson(readFile(getCurrentDir() / "packages.json"))
|
||||
|
||||
let pkg_list = parseJson(readFile(getCurrentDir() / "packages.json"))
|
||||
var names = initSet[string]()
|
||||
|
||||
for pdata in pkg_list:
|
||||
name = if pdata.hasKey("name"): pdata["name"].str else: nil
|
||||
name = if pdata.hasKey("name"): pdata["name"].str else: ""
|
||||
|
||||
if pdata.hasKey("alias"):
|
||||
verifyAlias(pdata, result)
|
||||
else:
|
||||
if name.isNil:
|
||||
if name == "":
|
||||
echo "E: missing package name"
|
||||
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):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user