modified Makefile +8 -0
| @@ -5,6 +5,7 @@ export CGO_CFLAGS := -I$(CURDIR)/internal/db/include -I$(SQLITE3_INC) |
| 5 | 5 | .PHONY: tools-install |
| 6 | 6 | tools-install: |
| 7 | 7 | go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest |
| 8 | + go install github.com/padiazg/go-crap@latest |
| 8 | 9 | |
| 9 | 10 | .PHONY: lint |
| 10 | 11 | lint: |
| @@ -64,6 +65,13 @@ lex-parse: |
| 64 | 65 | test: |
| 65 | 66 | go test -tags fts5 ./... |
| 66 | 67 | |
| 68 | +# CRAP score analysis (cyclomatic complexity x coverage). |
| 69 | +# The fts5 build tag is required for the test build, so it's exported via GOFLAGS |
| 70 | +# for the underlying `go test -cover` run go-crap performs. |
| 71 | +.PHONY: crap |
| 72 | +crap: |
| 73 | + GOFLAGS=-tags=fts5 go-crap scan --fail-above --threshold 30 |
| 74 | + |
| 67 | 75 | .PHONY: check |
| 68 | 76 | check: |
| 69 | 77 | cd web && bun run check |
| @@ -5,6 +5,7 @@ export CGO_CFLAGS := -I$(CURDIR)/internal/db/include -I$(SQLITE3_INC) |
| 5 | .PHONY: tools-install | 5 | .PHONY: tools-install |
| 6 | tools-install: | 6 | tools-install: |
| 7 | go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest | 7 | go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest |
| | 8 | + go install github.com/padiazg/go-crap@latest |
| 8 | | 9 | |
| 9 | .PHONY: lint | 10 | .PHONY: lint |
| 10 | lint: | 11 | lint: |
| @@ -64,6 +65,13 @@ lex-parse: |
| 64 | test: | 65 | test: |
| 65 | go test -tags fts5 ./... | 66 | go test -tags fts5 ./... |
| 66 | | 67 | |
| | 68 | +# CRAP score analysis (cyclomatic complexity x coverage). |
| | 69 | +# The fts5 build tag is required for the test build, so it's exported via GOFLAGS |
| | 70 | +# for the underlying `go test -cover` run go-crap performs. |
| | 71 | +.PHONY: crap |
| | 72 | +crap: |
| | 73 | + GOFLAGS=-tags=fts5 go-crap scan --fail-above --threshold 30 |
| | 74 | + |
| 67 | .PHONY: check | 75 | .PHONY: check |
| 68 | check: | 76 | check: |
| 69 | cd web && bun run check | 77 | cd web && bun run check |