Skip to content

Commit

Permalink
Add codespell to Makefile
Browse files Browse the repository at this point in the history
This commit integrates codespell into the Makefile. Running `make
verify-spelling` will trigger the tool to check the spelling in comments
and markdown files.

Signed-off-by: Bryan Cox <brcox@redhat.com>
  • Loading branch information
bryan-cox committed Dec 2, 2024
1 parent 83f4757 commit 23845fc
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
aks
WithT
witht
fo
AtLeast
thirdparty
notin
userA
ser
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ repos:
- --markdown-linebreak-ext=md
- repo: local
hooks:
- id: make-codespell
name: Verify codespell
description: Runs `make verify-codespell` to verify codespell format.
entry: make verify-codespell
language: system
- id: cpo-containerfiles-in-sync
name: cpo-containerfiles-in-sync
entry: ./hack/tools/git-hooks/cpo-containerfiles-in-sync.sh
Expand Down
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ CODE_GEN := $(abspath $(TOOLS_BIN_DIR)/codegen)
STATICCHECK := $(abspath $(TOOLS_BIN_DIR)/staticcheck)
GENAPIDOCS := $(abspath $(TOOLS_BIN_DIR)/gen-crd-api-reference-docs)

CODESPELL_VER := 2.3.0
CODESPELL_BIN := codespell
CODESPELL_DIST_DIR := codespell_dist
CODESPELL := $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR)/$(CODESPELL_BIN)

PROMTOOL=$(abspath $(TOOLS_BIN_DIR)/promtool)

GO_GCFLAGS ?= -gcflags=all='-N -l'
Expand Down Expand Up @@ -286,3 +291,23 @@ hypershift-install-aws-dev:
.PHONY: run-operator-locally-aws-dev
run-operator-locally-aws-dev:
@$(RUN_OPERATOR_LOCALLY_AWS)

.PHONY: verify-codespell
verify-codespell: codespell ## Verify codespell.
@$(CODESPELL) --count --ignore-words=./.codespellignore --skip="./hack/tools/bin/codespell_dist,./vendor/*,./api/vendor/*,./hack/tools/vendor/*,./api/hypershift/v1alpha1/*,./support/thirdparty/*,./docs/content/reference/*,./hack/tools/bin/*,./cmd/install/assets/*,./go.sum,./hack/workspace/go.work.sum,./api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests"

## --------------------------------------
## Tooling Binaries
## --------------------------------------

##@ Tooling Binaries:
codespell : $(CODESPELL) ## Build a local copy of codespell.

$(CODESPELL): ## Build codespell from tools folder.
mkdir -p $(TOOLS_BIN_DIR); \
mkdir -p $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR); \
mkdir -p $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR)/bin; \
mkdir -p $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR); \
pip install --target=$(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR) $(CODESPELL_BIN)==$(CODESPELL_VER) --upgrade; \
mv $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR)/bin/$(CODESPELL_BIN) $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR); \
rm -r $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR)/bin;

0 comments on commit 23845fc

Please sign in to comment.