diff --git a/Makefile b/Makefile index 0fec42078..d2ac520ac 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ test-integration: build ## run the integration tests $(DOCKER_RUN_TRAEFIK) ./script/make.sh generate test-integration validate: build ## validate gofmt, golint and go vet - $(DOCKER_RUN_TRAEFIK) ./script/make.sh validate-gofmt validate-govet validate-golint + $(DOCKER_RUN_TRAEFIK) ./script/make.sh validate-gofmt validate-govet validate-golint validate-misspell build: dist docker build $(DOCKER_BUILD_ARGS) -t "$(TRAEFIK_DEV_IMAGE)" -f build.Dockerfile . diff --git a/build.Dockerfile b/build.Dockerfile index 758d12f1e..439409c53 100644 --- a/build.Dockerfile +++ b/build.Dockerfile @@ -3,7 +3,8 @@ FROM golang:1.7 RUN go get github.com/Masterminds/glide \ && go get github.com/jteeuwen/go-bindata/... \ && go get github.com/golang/lint/golint \ -&& go get github.com/kisielk/errcheck +&& go get github.com/kisielk/errcheck \ +&& go get github.com/client9/misspell/cmd/misspell # Which docker version to test on ARG DOCKER_VERSION=1.10.1 diff --git a/cluster/datastore.go b/cluster/datastore.go index ec396bb5e..ce36e8fe4 100644 --- a/cluster/datastore.go +++ b/cluster/datastore.go @@ -248,6 +248,6 @@ func (s *datastoreTransaction) Commit(object Object) error { } s.dirty = true - log.Debugf("Transaction commited %s", s.id) + log.Debugf("Transaction committed %s", s.id) return nil } diff --git a/docs/basics.md b/docs/basics.md index d0011805c..1103aee81 100644 --- a/docs/basics.md +++ b/docs/basics.md @@ -270,7 +270,7 @@ Here is an example of backends and servers definition: Træfɪk's configuration has two parts: -- The [static Træfɪk configuration](/basics#static-trfk-configuration) which is loaded only at the begining. +- The [static Træfɪk configuration](/basics#static-trfk-configuration) which is loaded only at the beginning. - The [dynamic Træfɪk configuration](/basics#dynamic-trfk-configuration) which can be hot-reloaded (no need to restart the process). @@ -356,7 +356,7 @@ All those related flags will be displayed with : $ traefik [command] --help ``` -Note that each command is described at the begining of the help section: +Note that each command is described at the beginning of the help section: ```bash $ traefik --help diff --git a/script/validate-misspell b/script/validate-misspell new file mode 100755 index 000000000..6cc1e2fa4 --- /dev/null +++ b/script/validate-misspell @@ -0,0 +1,33 @@ +#!/bin/bash + +source "$(dirname "$BASH_SOURCE")/.validate" + +IFS=$'\n' +src=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/\|autogen' || true) ) +docs=( $(validate_diff --diff-filter=ACMR --name-only -- 'docs/*.md') ) +unset IFS +files=("${src[@]}" "${docs[@]}") + +errors=() +for f in "${files[@]}"; do + # we use source text here so we also check spelling of variable names + failedSpell=$(misspell -source=text "$f") + if [ "$failedSpell" ]; then + errors+=( "$failedSpell" ) + fi +done + +if [ ${#errors[@]} -eq 0 ]; then + echo 'Congratulations! All Go source files and docs have been checked for common mispellings.' +else + { + echo "Errors from misspell:" + for err in "${errors[@]}"; do + echo "$err" + done + echo + echo 'Please fix the above errors. You can test via "misspell" and commit the result.' + echo + } >&2 + false +fi