diff options
author | dkegel-fastly <[email protected]> | 2024-08-12 14:24:38 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2024-08-12 14:24:38 -0700 |
commit | 8135be4e908d0744c46399aac9d9fc3aa4a17e55 (patch) | |
tree | cf5ef0bcc9ee5dc935aeb26a29f056dc3d6217c9 /GNUmakefile | |
parent | 835e73237e7413b5b71a5fe04f642b1768778c66 (diff) | |
download | tinygo-8135be4e908d0744c46399aac9d9fc3aa4a17e55.tar.gz tinygo-8135be4e908d0744c46399aac9d9fc3aa4a17e55.zip |
GNUmakefile: add spellfix target, use it. (#4387)
TODO: Remove the go.mod/go.sum in internal/tools once doing so doesn't break CI (e.g. once we drop support for go 1.19)
* builder/cc1as.h: fix typo found by 'make spell'
* GNUmakefile: remove exception for inbetween, fix instance now found by 'make spell'
* GNUmakefile: remove exception for programmmer, fix instance now found by 'make spell'
* go.mod: use updated misspell. GNUmakefile: add spellfix target, use it.
* ignore directories properly when invoking spellchecker.
* make spell: give internal/tools its own go.mod, as misspell requires newer go
* make lint: depend on tools and run the installed revive
(which was perhaps implied by the change that added revive to internal/tools,
but not required in GNUmakefile until we gave internal/tools its own temporary go.mod)
* .github: now that 'make spell' works well, run it from CI
* GNUmakefile: make spell now aborts if it finds misspelt words, so what it finds doesn't get lost in CI logs
* GNUmakefile: tools: avoid -C option on go generate to make test-llvm15-go119 circleci job happy, see
https://cs.opensource.google/go/go/+/2af48cbb7d85e5fdc635e75b99f949010c607786
* internal/tools/go.mod: fix format of go version to leave out patchlevel, else go complains.
Diffstat (limited to 'GNUmakefile')
-rw-r--r-- | GNUmakefile | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/GNUmakefile b/GNUmakefile index a27489cc2..504e1561a 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -949,20 +949,25 @@ endif .PHONY: tools tools: - go generate -C ./internal/tools -tags tools ./ + cd internal/tools && go generate -tags tools ./ .PHONY: lint -lint: ## Lint source tree - go run github.com/mgechev/revive -version +lint: tools ## Lint source tree + revive -version # TODO: lint more directories! # revive.toml isn't flexible enough to filter out just one kind of error from a checker, so do it with grep here. # Can't use grep with friendly formatter. Plain output isn't too bad, though. # Use 'grep .' to get rid of stray blank line - go run github.com/mgechev/revive -config revive.toml compiler/... src/{os,reflect}/*.go | grep -v "should have comment or be unexported" | grep '.' | awk '{print}; END {exit NR>0}' + revive -config revive.toml compiler/... src/{os,reflect}/*.go | grep -v "should have comment or be unexported" | grep '.' | awk '{print}; END {exit NR>0}' +SPELLDIRSCMD=find . -depth 1 -type d | egrep -wv '.git|lib|llvm|src'; find src -depth 1 | egrep -wv 'device|internal|net|vendor'; find src/internal -depth 1 -type d | egrep -wv src/internal/wasi .PHONY: spell -spell: ## Spellcheck source tree - go run github.com/client9/misspell/cmd/misspell -i 'ackward,devided,extint,inbetween,programmmer,rela' $$( find . -depth 1 -type d | egrep -w -v 'lib|llvm|src/net' ) +spell: tools ## Spellcheck source tree + misspell -error --dict misspell.csv -i 'ackward,devided,extint,rela' $$( $(SPELLDIRSCMD) ) + +.PHONY: spellfix +spellfix: tools ## Same as spell, but fixes what it finds + misspell -w --dict misspell.csv -i 'ackward,devided,extint,rela' $$( $(SPELLDIRSCMD) ) # https://www.client9.com/self-documenting-makefiles/ .PHONY: help |