Package_scanner will now check for duplicate pkg names.
This commit is contained in:
parent
11fb1a8857
commit
eb5ca12960
1 changed files with 9 additions and 0 deletions
|
|
@ -20,6 +20,8 @@ import httpclient
|
||||||
import net
|
import net
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import sets
|
||||||
|
import strutils
|
||||||
|
|
||||||
const
|
const
|
||||||
|
|
||||||
|
|
@ -72,6 +74,8 @@ proc check(): int =
|
||||||
let
|
let
|
||||||
pkg_list = parseJson(readFile(getCurrentDir() / "packages.json"))
|
pkg_list = parseJson(readFile(getCurrentDir() / "packages.json"))
|
||||||
|
|
||||||
|
var names = initSet[string]()
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
|
@ -111,6 +115,11 @@ proc check(): int =
|
||||||
if not (pdata["license"].str in LICENSES):
|
if not (pdata["license"].str in LICENSES):
|
||||||
echo "W: ", name, " has an unexpected license: ", pdata["license"]
|
echo "W: ", name, " has an unexpected license: ", pdata["license"]
|
||||||
|
|
||||||
|
if name.normalize notin names:
|
||||||
|
names.incl(name.normalize)
|
||||||
|
else:
|
||||||
|
echo("E: ", name, ": a package by that name already exists.")
|
||||||
|
result.inc()
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Problematic packages count: ", result
|
echo "Problematic packages count: ", result
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue