Skip to content

Commit

Permalink
chore: enable codespell check (#48)
Browse files Browse the repository at this point in the history
Fixes: #28

---------

Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
  • Loading branch information
zhaohuabing authored Dec 18, 2024
1 parent d8d6584 commit 6f3fe96
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
Empty file added .codespell.ignorewords
Empty file.
1 change: 1 addition & 0 deletions .codespell.skip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./manifests/charts/ai-gateway-helm/crds/*
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ lint: golangci-lint
@echo "lint => ./..."
@$(GOLANGCI_LINT) run --build-tags==celvalidation ./...

.PHONY: codespell
CODESPELL_SKIP := $(shell cat .codespell.skip | tr \\n ',')
CODESPELL_IGNORE_WORDS := ".codespell.ignorewords"
codespell: $(CODESPELL)
@echo "spell => ./..."
@$(CODESPELL) --skip $(CODESPELL_SKIP) --ignore-words $(CODESPELL_IGNORE_WORDS)

# This runs the formatter on the codebase as well as goimports via gci.
.PHONY: format
format: gci gofumpt
Expand All @@ -48,7 +55,7 @@ apigen: controller-gen

# This runs all necessary steps to prepare for a commit.
.PHONY: precommit
precommit: tidy apigen format lint
precommit: tidy codespell apigen format lint

# This runs precommit and checks for any differences in the codebase, failing if there are any.
.PHONY: check
Expand Down Expand Up @@ -81,14 +88,14 @@ test-cel: envtest apigen format
# This builds a binary for the given command under the internal/cmd directory.
#
# Example:
# - `make build.controler`: will build the internal/cmd/controller directory.
# - `make build.controller`: will build the internal/cmd/controller directory.
# - `make build.extproc`: will build the internal/cmd/extproc directory.
#
# By default, this will build for the current GOOS and GOARCH.
# To build for multiple platforms, set the GOOS_LIST and GOARCH_LIST variables.
#
# Example:
# - `make build.controler GOOS_LIST="linux darwin" GOARCH_LIST="amd64 arm64"`
# - `make build.controller GOOS_LIST="linux darwin" GOARCH_LIST="amd64 arm64"`
GOOS_LIST ?= $(shell go env GOOS)
GOARCH_LIST ?= $(shell go env GOARCH)
.PHONY: build.%
Expand Down
8 changes: 8 additions & 0 deletions Makefile.tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
GO_FUMPT = $(LOCALBIN)/gofumpt
GCI = $(LOCALBIN)/gci
EDITORCONFIG_CHECKER = $(LOCALBIN)/editorconfig-checker
CODESPELL = $(LOCALBIN)/.venv/codespell@v2.3.0/bin/codespell

## Tool versions.
CONTROLLER_TOOLS_VERSION ?= v0.16.2
Expand Down Expand Up @@ -48,6 +49,13 @@ envtest: $(ENVTEST)
$(ENVTEST): $(LOCALBIN)
$(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest,$(ENVTEST_VERSION))

.bin/.venv/%:
mkdir -p $(@D)
python3 -m venv $@
$@/bin/pip3 install $$(echo $* | sed 's/@/==/')

$(CODESPELL): .bin/.venv/codespell@v2.3.0

# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# $1 - target path with name of binary
# $2 - package url which can be installed
Expand Down
2 changes: 1 addition & 1 deletion internal/apischema/openai/openai.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Package openai contains the followings are the OpenAI API schema definitions.
// Package openai contains the following are the OpenAI API schema definitions.
// Note that we intentionally do not use the code generation tools like OpenAPI Generator not only to keep the code simple
// but also because the OpenAI's OpenAPI definition is not compliant with the spec and the existing tools do not work well.
package openai
Expand Down

0 comments on commit 6f3fe96

Please sign in to comment.