Skip to content

Commit 309ef40

Browse files
anuraaganutanix-Hrushikesh
authored andcommitted
ci: migrate from codespell to misspell (envoyproxy#1300)
Signed-off-by: Hrushikesh Patil <[email protected]>
1 parent fe43a82 commit 309ef40

File tree

8 files changed

+58
-47
lines changed

8 files changed

+58
-47
lines changed

.codespell.ignorewords

Whitespace-only changes.

.codespell.skip

Lines changed: 0 additions & 17 deletions
This file was deleted.

.licenserc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ header:
2626
- "**/.gitignore"
2727
- "**/.helmignore"
2828
- .trivyignore
29-
- ".codespell.*"
3029
- .editorconfig
3130
- .golangci.yml
31+
- .misspellignore
3232
- .prettierignore
3333
- .testcoverage.yml
3434
- LICENSE

.misspellignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/manifests/charts/ai-gateway-helm/crds/*
2+
/site/package-lock.json
3+
/site/package.json
4+
/site/node_modules/*
5+
/site/build/*
6+
/site/npm-debug.log*
7+
/site/yarn-debug.log*
8+
/site/yarn-error.log*
9+
go.mod
10+
go.sum
11+
/tests/e2e/logs
12+
/tests/e2e-inference-extension/logs
13+
/tests/e2e-upgrade/logs
14+
*_for_tests.yaml
15+
/tests/extproc/testdata/server.*
16+
/tests/internal/testopenai/cassettes/*.yaml
17+
/tests/internal/testopeninference/spans/*.json
18+
/.golangci.yml

Makefile

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
# in the command line every time.
99
-include .makerc
1010

11-
# The Go-based tools are defined in Makefile.tools.mk.
12-
include Makefile.tools.mk
11+
GO_TOOL := go tool -modfile=tools/go.mod
1312

1413
# The list of commands that can be built.
1514
COMMANDS := controller extproc
@@ -47,19 +46,17 @@ help:
4746
# This runs all necessary steps to prepare for a commit.
4847
.PHONY: precommit
4948
precommit: ## Run all necessary steps to prepare for a commit.
50-
precommit: tidy codespell apigen apidoc format lint editorconfig helm-test
49+
precommit: tidy spellcheck apigen apidoc format lint editorconfig helm-test
5150

5251
.PHONY: lint
5352
lint: ## This runs the linter, formatter, and tidy on the codebase.
5453
@echo "lint => ./..."
5554
@$(GO_TOOL) golangci-lint run --build-tags==test_crdcel,test_controller,test_extproc,test_e2e ./...
5655

57-
.PHONY: codespell
58-
CODESPELL_SKIP := $(shell cat .codespell.skip | tr \\n ',')
59-
CODESPELL_IGNORE_WORDS := ".codespell.ignorewords"
60-
codespell: $(CODESPELL) ## Spell check the codebase.
61-
@echo "spell => ./..."
62-
@$(CODESPELL) --skip $(CODESPELL_SKIP) --ignore-words $(CODESPELL_IGNORE_WORDS)
56+
.PHONY: spellcheck
57+
spellcheck: ## Spell check the codebase.
58+
@echo "misspell => ./..."
59+
@$(GO_TOOL) misspell -error $$(git ls-files --cached --others --exclude-standard | (cd tools && go run ./ignorepaths ../.misspellignore))
6360

6461
# Some IDEs like Goland place `.go` files in the `.idea` directory when using code templates. Using a
6562
# git command to find the files ensures that only relevant files are formatted and that git-ignored

Makefile.tools.mk

Lines changed: 0 additions & 19 deletions
This file was deleted.

tools/go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ tool (
77
github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker
88
github.com/elastic/crd-ref-docs
99
github.com/golangci/golangci-lint/v2/cmd/golangci-lint
10+
github.com/golangci/misspell/cmd/misspell
1011
github.com/tetratelabs/func-e/cmd/func-e
1112
github.com/vladopajic/go-test-coverage/v2
1213
github.com/wasilibs/go-prettier/v3/cmd/prettier
@@ -16,6 +17,8 @@ tool (
1617
sigs.k8s.io/kind
1718
)
1819

20+
require github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00
21+
1922
require (
2023
4d63.com/gocheckcompilerdirectives v1.3.0 // indirect
2124
4d63.com/gochecknoglobals v0.2.2 // indirect
@@ -226,7 +229,6 @@ require (
226229
github.com/moby/term v0.5.2 // indirect
227230
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
228231
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
229-
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
230232
github.com/moricho/tparallel v0.3.2 // indirect
231233
github.com/muesli/termenv v0.16.0 // indirect
232234
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect

tools/ignorepaths/main.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright Envoy AI Gateway Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
// The full text of the Apache license is available in the LICENSE file at
4+
// the root of the repo.
5+
6+
package main
7+
8+
import (
9+
"bufio"
10+
"fmt"
11+
"os"
12+
13+
"github.com/monochromegane/go-gitignore"
14+
)
15+
16+
// Takes a list of file paths from stdin and filters them based on the given .gitignore-style file.
17+
18+
func main() {
19+
gi, err := gitignore.NewGitIgnore(os.Args[1], ".")
20+
if err != nil {
21+
panic(err)
22+
}
23+
24+
s := bufio.NewScanner(os.Stdin)
25+
for s.Scan() {
26+
if !gi.Match(s.Text(), false) {
27+
_, _ = fmt.Fprintln(os.Stdout, s.Text())
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)