Skip to content

Commit 945f40a

Browse files
authored
Merge pull request #55 from 4rivappa/spell-lint
feat: add spell check - misspell
2 parents 894e9d1 + 5dcba21 commit 945f40a

File tree

6 files changed

+33
-5
lines changed

6 files changed

+33
-5
lines changed

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,11 @@ test-e2e: chainsaw # Run e2e tests against the K8s cluster specified in ~/.kube/
8787
$(CHAINSAW) test --values ./test/e2e/values.yaml
8888

8989
.PHONY: lint
90-
lint: golangci-lint.client golangci-lint.controller golangci-lint.sidecar ## Run all linters (suggest `make -k`)
90+
lint: golangci-lint.client golangci-lint.controller golangci-lint.sidecar spell-lint ## Run all linters (suggest `make -k`)
9191
golangci-lint.%: golangci-lint
9292
cd $* && $(GOLANGCI_LINT) run $(GOLANGCI_LINT_RUN_OPTS) --config $(CURDIR)/.golangci.yaml --new
93+
spell-lint:
94+
git ls-files | grep -v -e CHANGELOG -e go.mod -e go.sum -e vendor | xargs $(SPELL_LINT) -i "Creater,creater,ect" -error -o stderr
9395

9496
.PHONY: lint-fix
9597
lint-fix: golangci-lint-fix.client golangci-lint-fix.controller golangci-lint-fix.sidecar ## Run all linters and perform fixes where possible (suggest `make -k`)
@@ -167,6 +169,7 @@ GOLANGCI_LINT ?= $(TOOLBIN)/golangci-lint
167169
KIND ?= $(TOOLBIN)/kind
168170
KUSTOMIZE ?= $(TOOLBIN)/kustomize
169171
MDBOOK ?= $(TOOLBIN)/mdbook
172+
SPELL_LINT ?= $(TOOLBIN)/spell-lint
170173

171174
# Tool Versions
172175
CHAINSAW_VERSION ?= v0.2.12
@@ -176,6 +179,7 @@ GOLANGCI_LINT_VERSION ?= v1.64.7
176179
KIND_VERSION ?= v0.27.0
177180
KUSTOMIZE_VERSION ?= v5.6.0
178181
MDBOOK_VERSION ?= v0.4.47
182+
SPELL_LINT_VERSION ?= v0.6.0
179183

180184
.PHONY: chainsaw
181185
chainsaw: $(CHAINSAW)-$(CHAINSAW_VERSION)
@@ -212,6 +216,11 @@ mdbook: $(MDBOOK)-$(MDBOOK_VERSION)
212216
$(MDBOOK)-$(MDBOOK_VERSION): $(TOOLBIN)
213217
./hack/tools/install-mdbook.sh $(MDBOOK) $(MDBOOK_VERSION)
214218

219+
.PHONY: spell-lint
220+
spell-lint: $(SPELL_LINT)-$(SPELL_LINT_VERSION)
221+
$(SPELL_LINT)-$(SPELL_LINT_VERSION): $(TOOLBIN)
222+
./hack/tools/install-misspell-lint.sh $(TOOLBIN) $(SPELL_LINT) $(SPELL_LINT_VERSION)
223+
215224
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
216225
# $1 - target path with name of binary
217226
# $2 - package url which can be installed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Create a new issue raising a RFC for the changes following this format:
2929
**Description:**
3030
> 1. Protocol:
3131
> 2. Fields Added:
32-
> 3. Why is this change neccessary?
32+
> 3. Why is this change necessary?
3333
> ...(describe why here)...
3434
> 4. Which other COSI projects are affected by this change?
3535
> 5. Upgrade plan
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
TOOLBIN="${1}"
6+
SPELL_LINT="${2}"
7+
SPELL_LINT_VERSION="${3}"
8+
9+
# If it exists, do not redownload
10+
if [ -f "${SPELL_LINT}-${SPELL_LINT_VERSION}" ]; then
11+
exit 0
12+
fi
13+
14+
INSTALLER="https://raw.githubusercontent.com/golangci/misspell/master/install-misspell.sh"
15+
16+
curl -sSfL "${INSTALLER}" | sh -s -- -b "${TOOLBIN}" "${SPELL_LINT_VERSION}"
17+
18+
mv "${TOOLBIN}/misspell" "${SPELL_LINT}-${SPELL_LINT_VERSION}"
19+
ln -sf "${SPELL_LINT}-${SPELL_LINT_VERSION}" "${SPELL_LINT}"

sidecar/pkg/bucket/bucket_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ func (b *BucketListener) Update(ctx context.Context, old, new *v1alpha1.Bucket)
264264
return nil
265265
}
266266

267-
// Delete attemps to delete a bucket. This function must be idempotent
267+
// Delete attempts to delete a bucket. This function must be idempotent
268268
// Delete function is called when the bucket was not able to add finalizers while creation.
269269
// Hence we will take care of removing the BucketClaim finalizer before deleting the Bucket object.
270270
// Return values

sidecar/pkg/bucketaccess/bucketaccess_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ func (bal *BucketAccessListener) Update(ctx context.Context, old, new *v1alpha1.
321321
return nil
322322
}
323323

324-
// Delete attemps to delete a bucketAccess. This function must be idempotent
324+
// Delete attempts to delete a bucketAccess. This function must be idempotent
325325
// Return values
326326
// - nil - BucketAccess successfully deleted
327327
// - non-nil err - Internal error [requeue'd with exponential backoff]

test/e2e/chainsaw-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ spec:
253253
items:
254254
- key: BucketInfo
255255
path: BucketInfo
256-
- name: Check if ObjectStorage validation tool completed succesfully
256+
- name: Check if ObjectStorage validation tool completed successfully
257257
try:
258258
- assert:
259259
resource:

0 commit comments

Comments
 (0)