Skip to content
This repository was archived by the owner on Apr 12, 2022. It is now read-only.

Commit fc489bf

Browse files
authored
Merge pull request #142 from islinwb/add_spelling_check
Add spelling check script and fix typos
2 parents 4f74ea0 + fe61002 commit fc489bf

36 files changed

+34138
-21
lines changed

Gopkg.lock

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
required = [
2828
"github.com/onsi/ginkgo/ginkgo",
2929
"github.com/docker/distribution",
30+
"github.com/client9/misspell",
31+
"github.com/client9/misspell/cmd/misspell",
3032
]
3133

3234
[[constraint]]

build/copy-output.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# Copies any built binaries (and other generated files) out of the Docker build contianer.
17+
# Copies any built binaries (and other generated files) out of the Docker build container.
1818
set -o errexit
1919
set -o nounset
2020
set -o pipefail

hack/.spelling_failures

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
BUILD
2+
OWNERS
3+
third_party/
4+
vendor/

hack/make-rules/verify.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function run-cmd {
7777
return ${tr}
7878
}
7979

80-
# Collect Failed tests in this Array , initalize it to nil
80+
# Collect Failed tests in this Array , initialize it to nil
8181
FAILED_TESTS=()
8282

8383
function print-failed-tests {

hack/release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ kube::version::get_version_vars
5353

5454
# This is to prevent the script from starting if its on a dirty commit.
5555
if [[ "${KUBE_GIT_VERSION}" != "${RELEASE_TAG}" ]]; then
56-
echo "Version being build: ${KUBE_GIT_VERSION} does not match the release version: ${RELEASE_TAG}, there probably is uncommited work."
56+
echo "Version being build: ${KUBE_GIT_VERSION} does not match the release version: ${RELEASE_TAG}, there probably is uncommitted work."
5757
exit 1
5858
else
5959
echo "Using ${RELEASE_TAG} for release push"

hack/verify-spelling.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2018 The Kubernetes Authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -o errexit
17+
set -o nounset
18+
set -o pipefail
19+
20+
export KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
21+
source "${KUBE_ROOT}/hack/lib/init.sh"
22+
23+
# Ensure that we find the binaries we build before anything else.
24+
export GOBIN="${KUBE_OUTPUT_BINPATH}"
25+
PATH="${GOBIN}:${PATH}"
26+
27+
# Install tools we need, but only from vendor/...
28+
go install github.com/kubernetes-sigs/poseidon/vendor/github.com/client9/misspell/cmd/misspell
29+
30+
# Spell checking
31+
# All the skipping files are defined in hack/.spelling_failures
32+
skipping_file="${KUBE_ROOT}/hack/.spelling_failures"
33+
failing_packages=$(echo `cat ${skipping_file}` | sed "s| | -e |g")
34+
git ls-files | grep -v -e ${failing_packages} | xargs misspell -i "Creater,creater,ect" -error -o stderr

pkg/k8sclient/nodewatcher_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ func TestNodeWatcher_enqueueNodeAddition(t *testing.T) {
268268
defer testObj.mockCtrl.Finish()
269269

270270
nodeWatch := NewNodeWatcher(testObj.kubeClient, testObj.firmamentClient)
271-
keychan := make(chan interface{})
271+
keychain := make(chan interface{})
272272
itemschan := make(chan []interface{})
273273

274274
for _, testValue := range testData {
@@ -279,13 +279,13 @@ func TestNodeWatcher_enqueueNodeAddition(t *testing.T) {
279279
nodeWatch.enqueueNodeAddition(key, testValue.node)
280280
go func() {
281281
newkey, newitems, _ := nodeWatch.nodeWorkQueue.Get()
282-
keychan <- newkey
282+
keychain <- newkey
283283
itemschan <- newitems
284284
}()
285285
waitTimer := time.NewTimer(time.Second * 5)
286286
select {
287287
case <-waitTimer.C:
288-
case newkey := <-keychan:
288+
case newkey := <-keychain:
289289
newitem := <-itemschan
290290

291291
for _, item := range newitem {

pkg/k8sclient/podwatcher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ func (pw *PodWatcher) podWorker() {
434434
PodMux.Lock()
435435

436436
// check if the pod already exists
437-
// this cases happend when Replicaset are used.
437+
// this cases happened when Replicaset are used.
438438
// When a replicaset is delete it creates more pods with the same name
439439
_, ok := PodToTD[pod.Identifier]
440440
if ok {

pkg/k8sclient/podwatcher_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ func TestNewPodWatcher(t *testing.T) {
212212
func TestPodWatcher_enqueuePodAddition(t *testing.T) {
213213
var empty map[string]string
214214
fakeNow := metav1.Now()
215-
keychan := make(chan interface{})
215+
keychain := make(chan interface{})
216216
itemschan := make(chan []interface{})
217217
fakeOwnerRef := "abcdfe12345"
218218

@@ -511,13 +511,13 @@ func TestPodWatcher_enqueuePodAddition(t *testing.T) {
511511
podWatch.enqueuePodAddition(key, podData.pod)
512512
go func() {
513513
newkey, newitems, _ := podWatch.podWorkQueue.Get()
514-
keychan <- newkey
514+
keychain <- newkey
515515
itemschan <- newitems
516516
}()
517517
waitTimer := time.NewTimer(time.Second * 2)
518518
select {
519519
case <-waitTimer.C:
520-
case newkey := <-keychan:
520+
case newkey := <-keychain:
521521
newitems := <-itemschan
522522
for _, item := range newitems {
523523
if newItem, ok := item.(*Pod); ok {

0 commit comments

Comments
 (0)