Makefile 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. CONTAINER=nickg/misspell
  2. install: ## install misspell into GOPATH/bin
  3. go install ./cmd/misspell
  4. build: hooks ## build and lint misspell
  5. go install ./cmd/misspell
  6. gometalinter \
  7. --vendor \
  8. --deadline=60s \
  9. --disable-all \
  10. --enable=vet \
  11. --enable=golint \
  12. --enable=gofmt \
  13. --enable=goimports \
  14. --enable=gosimple \
  15. --enable=staticcheck \
  16. --enable=ineffassign \
  17. --exclude=/usr/local/go/src/net/lookup_unix.go \
  18. ./...
  19. go test .
  20. test: ## run all tests
  21. go test .
  22. # the grep in line 2 is to remove misspellings in the spelling dictionary
  23. # that trigger false positives!!
  24. falsepositives: /scowl-wl
  25. cat /scowl-wl/words-US-60.txt | \
  26. grep -i -v -E "payed|Tyre|Euclidian|nonoccurence|dependancy|reenforced|accidently|surprize|dependance|idealogy|binominal|causalities|conquerer|withing|casette|analyse|analogue|dialogue|paralyse|catalogue|archaeolog|clarinettist|catalyses|cancell|chisell|ageing|cataloguing" | \
  27. misspell -debug -error
  28. cat /scowl-wl/words-GB-ise-60.txt | \
  29. grep -v -E "payed|nonoccurence|withing" | \
  30. misspell -locale=UK -debug -error
  31. # cat /scowl-wl/words-GB-ize-60.txt | \
  32. # grep -v -E "withing" | \
  33. # misspell -debug -error
  34. # cat /scowl-wl/words-CA-60.txt | \
  35. # grep -v -E "withing" | \
  36. # misspell -debug -error
  37. bench: ## run benchmarks
  38. go test -bench '.*'
  39. clean: ## clean up time
  40. rm -rf dist/ bin/
  41. go clean ./...
  42. git gc --aggressive
  43. ci: ## run test like travis-ci does, requires docker
  44. docker run --rm \
  45. -v $(PWD):/go/src/github.com/client9/misspell \
  46. -w /go/src/github.com/client9/misspell \
  47. ${CONTAINER} \
  48. make build falsepositives
  49. docker-build: ## build a docker test image
  50. docker build -t ${CONTAINER} .
  51. docker-pull: ## pull latest test image
  52. docker pull ${CONTAINER}
  53. docker-console: ## log into the test image
  54. docker run --rm -it \
  55. -v $(PWD):/go/src/github.com/client9/misspell \
  56. -w /go/src/github.com/client9/misspell \
  57. ${CONTAINER} sh
  58. .git/hooks/pre-commit: scripts/pre-commit.sh
  59. cp -f scripts/pre-commit.sh .git/hooks/pre-commit
  60. .git/hooks/commit-msg: scripts/commit-msg.sh
  61. cp -f scripts/commit-msg.sh .git/hooks/commit-msg
  62. hooks: .git/hooks/pre-commit .git/hooks/commit-msg ## install git precommit hooks
  63. .PHONY: help ci console docker-build bench
  64. # https://www.client9.com/self-documenting-makefiles/
  65. help:
  66. @awk -F ':|##' '/^[^\t].+?:.*?##/ {\
  67. printf "\033[36m%-30s\033[0m %s\n", $$1, $$NF \
  68. }' $(MAKEFILE_LIST)
  69. .DEFAULT_GOAL=help
  70. .PHONY=help