1
0
mirror of https://github.com/danog/liquid.git synced 2024-11-30 06:08:57 +01:00

Add make pre-commit; lint before testing

This commit is contained in:
Oliver Steele 2018-06-05 15:47:13 -04:00
parent ca945a04d1
commit 20a3b002f5
No known key found for this signature in database
GPG Key ID: 068C0470ACDE85DF
3 changed files with 19 additions and 10 deletions

View File

@ -9,8 +9,8 @@ install:
- make setup
script:
- $HOME/gopath/bin/goveralls -service=travis-ci
- make lint
- $HOME/gopath/bin/goveralls -service=travis-ci
notifications:
email:

View File

@ -25,6 +25,12 @@ Install package dependencies and development tools:
### Test and Lint
```bash
make pre-commit
```
You can also do these individually:
```bash
go test ./...
make lint

View File

@ -6,21 +6,28 @@ PACKAGE = github.com/osteele/liquid
LDFLAGS=
.DEFAULT_GOAL: ci
.PHONY: clean ci deps setup install lint test help
ci: setup test #lint
.PHONY: ci clean coverage deps generate imports install lint pre-commit setup test help
clean: ## remove binary files
rm -f ${LIB} ${CMD}
coverage: ## test the package, with coverage
go test -cov ./...
deps: ## list dependencies
@go list -f '{{join .Deps "\n"}}' ./... | grep -v `go list -f '{{.ImportPath}}'` | grep '\.' | sort | uniq
generate: ## re-generate lexers and parser
go generate ./...
imports: ## list imports
@go list -f '{{join .Imports "\n"}}' ./... | grep -v `go list -f '{{.ImportPath}}'` | grep '\.' | sort | uniq
generate:
go generate ./...
lint: ## lint the package
gometalinter ./... --tests --deadline=5m --include=gofmt --exclude expressions/scanner.go --exclude y.go --exclude '.*_string.go' --disable=gotype --disable=interfacer
@echo lint passed
pre-commit: lint test ## lint and test the package
setup: ## install dependencies and development tools
go get golang.org/x/tools/cmd/stringer
@ -29,10 +36,6 @@ setup: ## install dependencies and development tools
go get github.com/alecthomas/gometalinter
gometalinter --install
lint: ## lint the package
gometalinter ./... --tests --deadline=5m --include=gofmt --exclude expressions/scanner.go --exclude y.go --exclude '.*_string.go' --disable=gotype --disable=interfacer
@echo lint passed
test: ## test the package
go test ./...