Skip to content

Commit 6f3daa2

Browse files
committed
chore: add typo check to linter
1 parent de5ffae commit 6f3daa2

File tree

6 files changed

+42
-3
lines changed

6 files changed

+42
-3
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ jobs:
2121
go-version-file: go.mod
2222
cache: true
2323

24+
- name: Check for typos
25+
uses: crate-ci/typos@631208b7aac2daa8b707f55e7331f9112b0e062d # v1.44.0
26+
with:
27+
config: .github/workflows/typos.toml
28+
2429
- name: Lint
2530
run: make lint
2631

.github/workflows/typos.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[default]
2+
extend-ignore-re = ["(#|//)\\s*spellchecker:ignore-next-line\\n.*"]
3+
4+
[default.extend-words]
5+
trialer = "trialer"
6+
7+
[files]
8+
extend-exclude = [
9+
"go.sum",
10+
"go.mod",
11+
# Fixtures contain truncated streaming chunks that look like typos
12+
"fixtures/**",
13+
# Test files contain hashes and redacted values that look like typos
14+
"**/*_test.go",
15+
]

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55

66
# Project specific
77
example/aibridge.db
8+
build/
89

Makefile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,32 @@ SHELL_SRC_FILES := $(shell find . -type f -name '*.sh' -not -path '*/.git/*')
1717
GOLANGCI_LINT_VERSION ?= 1.64.8
1818
PARALLELTESTCTX_VERSION ?= 0.0.1
1919

20-
lint: lint/shellcheck lint/go
20+
lint: lint/shellcheck lint/go lint/typos
2121
.PHONY: lint
2222

2323
lint/go:
2424
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v$(GOLANGCI_LINT_VERSION) run
2525
go run github.com/coder/paralleltestctx/cmd/paralleltestctx@v$(PARALLELTESTCTX_VERSION) -custom-funcs="testutil.Context" ./...
2626
.PHONY: lint/go
2727

28+
TYPOS_VERSION := $(shell grep -oP 'crate-ci/typos@\S+\s+\#\s+v\K[0-9.]+' .github/workflows/ci.yml)
29+
TYPOS_ARCH := $(shell uname -m)
30+
ifeq ($(shell uname -s),Darwin)
31+
TYPOS_OS := apple-darwin
32+
else
33+
TYPOS_OS := unknown-linux-musl
34+
endif
35+
36+
build/typos-$(TYPOS_VERSION):
37+
mkdir -p build/
38+
curl -sSfL "https://github.com/crate-ci/typos/releases/download/v$(TYPOS_VERSION)/typos-v$(TYPOS_VERSION)-$(TYPOS_ARCH)-$(TYPOS_OS).tar.gz" \
39+
| tar -xzf - -C build/ ./typos
40+
mv build/typos "$@"
41+
42+
lint/typos: build/typos-$(TYPOS_VERSION)
43+
build/typos-$(TYPOS_VERSION) --config .github/workflows/typos.toml
44+
.PHONY: lint/typos
45+
2846
lint/shellcheck:
2947
if test -n "$(strip $(SHELL_SRC_FILES))"; then \
3048
echo "--- shellcheck"; \

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ See [example/](example/) for a complete runnable example with SQLite persistence
118118
5. **Test with Claude Code**:
119119
Claude Code allows a base URL override via `ANTHROPIC_BASE_URL`.
120120

121-
![image with cloude code example](example/claude-code.png)
121+
![image with claude code example](example/claude-code.png)
122122

123123
## Supported Routes
124124

intercept/apidump/apidump.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func (d *dumper) dumpResponse(resp *http.Response) error {
153153
// writeRedactedHeaders writes HTTP headers in wire format (Key: Value\r\n) to w,
154154
// redacting sensitive values and applying any overrides. Headers are sorted by key
155155
// for deterministic output.
156-
// `sensitive` and `overrides` must both supply keys in canoncialized form.
156+
// `sensitive` and `overrides` must both supply keys in canonicalized form.
157157
// See [textproto.MIMEHeader].
158158
func (*dumper) writeRedactedHeaders(w io.Writer, headers http.Header, sensitive map[string]struct{}, overrides map[string]string) error {
159159
// Collect all header keys including overrides.

0 commit comments

Comments
 (0)