From 3708fa864b2c5961e48361bf274e77e94b86d6e8 Mon Sep 17 00:00:00 2001 From: Ed Robinson Date: Wed, 16 Nov 2016 02:32:01 +0000 Subject: [PATCH 1/5] Fixes a spelling error --- cluster/datastore.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 } From 7af6bc093d366a181fc646cbca85d425899baf50 Mon Sep 17 00:00:00 2001 From: Ed Robinson Date: Wed, 16 Nov 2016 09:12:49 +0000 Subject: [PATCH 2/5] Adds misspell validation --- build.Dockerfile | 3 ++- script/validate-misspell | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100755 script/validate-misspell 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/script/validate-misspell b/script/validate-misspell new file mode 100755 index 000000000..bf64fcc70 --- /dev/null +++ b/script/validate-misspell @@ -0,0 +1,31 @@ +#!/bin/bash + +source "$(dirname "$BASH_SOURCE")/.validate" + +IFS=$'\n' +files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/\|autogen' || true) ) +unset IFS + +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 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 From adf385fdf30000e6998967cd61f848770d3753f5 Mon Sep 17 00:00:00 2001 From: Ed Robinson Date: Wed, 16 Nov 2016 09:42:10 +0000 Subject: [PATCH 3/5] Fix docs misspelling --- docs/basics.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From f0b991e1a8c8fd2fbe29a33bde2bd33c77ba7f84 Mon Sep 17 00:00:00 2001 From: Ed Robinson Date: Wed, 16 Nov 2016 09:50:20 +0000 Subject: [PATCH 4/5] Validate misspellings in documentation --- script/validate-misspell | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/script/validate-misspell b/script/validate-misspell index bf64fcc70..6cc1e2fa4 100755 --- a/script/validate-misspell +++ b/script/validate-misspell @@ -3,8 +3,10 @@ source "$(dirname "$BASH_SOURCE")/.validate" IFS=$'\n' -files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/\|autogen' || true) ) +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 @@ -16,7 +18,7 @@ for f in "${files[@]}"; do done if [ ${#errors[@]} -eq 0 ]; then - echo 'Congratulations! All Go source files have been checked for common mispellings.' + echo 'Congratulations! All Go source files and docs have been checked for common mispellings.' else { echo "Errors from misspell:" From 874ea62dd52cee9e1890d4d9df2ddb178d58b929 Mon Sep 17 00:00:00 2001 From: Ed Robinson Date: Wed, 16 Nov 2016 11:04:26 +0000 Subject: [PATCH 5/5] Adds misspell to validate target --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 .