prysm-pulse/tools/specs-checker/main.go
Victor Farazdagi 3d3b9d1217
Spec checker tool (#8722)
* Add specdocs static code analyzer

* docs pulling script

* update content pulling script

* add test

* better parsing of incoming docs

* update test

* implements analyzer

* separate tool

* remove analyzer code

* cleanup

* deep source fixes

* untrack raw specs files

* add back phase0 defs

* update spec texts

* re-arrange code

* updated spec list

* cleanup

* more comments and readme

* add merkle proofs specs

* add extra.md

* mark wrong length issue

* update readme

* update readme

* remove non-def snippets

* update comment

* check numrows

* ignore last empty line

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
2021-04-15 14:54:07 +00:00

65 lines
1020 B
Go

package main
import (
"embed"
"log"
"os"
"github.com/urfave/cli/v2"
)
var (
dirFlag = &cli.StringFlag{
Name: "dir",
Value: "",
Usage: "Target directory",
Required: true,
}
)
//go:embed data
var specFS embed.FS
var specDirs = map[string][]string{
"specs/phase0": {
"beacon-chain.md",
"fork-choice.md",
"validator.md",
"weak-subjectivity.md",
},
"ssz": {
"merkle-proofs.md",
},
}
func main() {
app := &cli.App{
Name: "Specs checker utility",
Description: "Checks that specs pseudo code used in comments is up to date",
Usage: "helps keeping specs pseudo code up to date!",
Commands: []*cli.Command{
{
Name: "check",
Usage: "Checks that all doc strings",
Flags: []cli.Flag{
dirFlag,
},
Action: check,
},
{
Name: "download",
Usage: "Downloads the latest specs docs",
Action: download,
Flags: []cli.Flag{
dirFlag,
},
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}