nkb lint
Sprawdza plik paczki według reguł formatu paczki i zgłasza każdy problem w jednym przebiegu.
nkb lint <file.toml> [--json] [--explain]
Co sprawdza?
Wszystko, czego format paczki wymaga od pliku, od kodowania po zdanie, które mówi, co psuje każda wartość. Wartość bez tego zdania jest błędem, bo to ono sprawia, że katalog jest wart więcej niż lista. Każde uruchomienie mówi, ile reguł formatu sprawdza ta wersja programu, a --explain wypisuje każdą regułę i to, dlaczego te nieliczne, których nie sprawdza, czekają.
Przykłady
Plik, który przechodzi:
$ nkb lint my-pack.toml
0 errors, 0 warnings.
Checked 39 of 45 rules, 1 of them only in part. 5 not checked - run `nkb lint --explain` to see which and why.
The pack format is not frozen yet: it freezes with the first public release that ships packs.
Wartość, która nie mówi nic o tym, co psuje:
$ nkb lint my-pack.toml
my-pack.toml:38 E030 value `trailing-space` declares no `breaks`. It is the field this catalogue exists for: say what this value usually breaks and why, or the value is a curiosity rather than a test case.
1 error, 0 warnings.
Ten sam werdykt dla pipeline, z --json, i nic poza nim na standardowym wyjściu:
$ nkb lint my-pack.toml --json
{
"schema": 1,
"tool_version": "0.1.0",
"pack_format": 1,
"format_frozen": false,
"accepted": false,
Czy format jest ostateczny?
Jeszcze nie. Zamraża się wraz z pierwszym publicznym wydaniem, które wiezie paczki, a nkb lint mówi to przy każdym uruchomieniu, żeby plik, który przechodzi dziś, nie był czytany jako obietnica na jutro.
Opcje
Kody wyjścia
| Kod | Znaczenie |
|---|---|
0 | paczka przeszła każdą regułę, którą sprawdza ta wersja programu |
1 | paczka złamała co najmniej jedną regułę blokującą |
2 | polecenie wywołano niepoprawnie |
3 | pod tą ścieżką nie ma pliku paczki do odczytania |
5 | plik istnieje, ale nie dało się go odczytać, albo nie dało się zapisać werdyktu na standardowe wyjście |
Pomoc, tak jak wypisuje ją program
Co wypisuje nkb lint --help (nkb 0.1.0).
nkb lint - check a pack file against the format rules
Usage:
nkb lint <file.toml> [--json] [--explain]
Options:
--json Write the verdict as JSON, and nothing else
--explain List every rule and whether this build checks it
-h, --help Show this help and exit with 0
Exit codes:
0 the pack passed every rule this build checks
1 the pack broke at least one blocking rule
2 the command was called wrongly
3 there is no pack file to read at that path
5 the file is there and could not be read, or the verdict
could not be written to standard output