Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 7 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,10 @@ STATICCHECK := $(abspath $(TOOLS_BIN_DIR)/staticcheck)
GENAPIDOCS := $(abspath $(TOOLS_BIN_DIR)/gen-crd-api-reference-docs)
MOCKGEN := $(abspath $(TOOLS_BIN_DIR)/mockgen)

CODESPELL_VER := 2.4.1
CODESPELL_BIN := codespell
CODESPELL_DIST_DIR := codespell_dist
CODESPELL := $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR)/$(CODESPELL_BIN)
UVX ?= uvx

CODESPELL_VER := 2.4.1
GITLINT_VER := 0.19.1
GITLINT_DIST_DIR := gitlint_dist
GITLINT_BIN := gitlint
GITLINT := $(TOOLS_BIN_DIR)/$(GITLINT_DIST_DIR)/$(GITLINT_BIN)-bin

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

Expand Down Expand Up @@ -384,14 +379,14 @@ 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,./docs/site/*,./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,./hack/tools/go.mod,./hack/tools/go.sum,./karpenter-operator/controllers/karpenter/assets/*.yaml,./dev/*"
verify-codespell: ## Verify codespell.
@$(UVX) codespell==$(CODESPELL_VER) --count --ignore-words=./.codespellignore --skip="./docs/site/*,./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,./hack/tools/go.mod,./hack/tools/go.sum,./karpenter-operator/controllers/karpenter/assets/*.yaml,./dev/*"
Comment on lines +382 to +383
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

uvx version specifier syntax @ == documentation

💡 Result:

In uvx (alias of uv tool run), @ and == apply in different places:

  • command@<version> (uvx shorthand) = exact tool version only
    Use this when the command name itself includes a pinned version, e.g. uvx ruff@0.6.0 check. The docs note this form and that @ is for an exact version (and @latest is also supported). [2]

  • --from / --with use standard Python dependency specifiers (PEP 508), e.g. ==, ranges, extras
    Examples:

    • uvx --from 'ruff==0.3.0' ruff check
    • uvx --from 'ruff>0.2.0,<0.3.0' ruff check
    • uvx --from 'mypy[faster-cache,reports]==1.13.0' mypy ...
      This is standard “dependency specifier” syntax (name[extras] ==1.2.3, >=, <, !=, etc.). [2][3]
  • CLI reference confirms command may include <package>@<version> (for the command token), and uvx behavior matches uv tool run. [1]

If you’re trying something like --with "pkg@1.2.3", that typically won’t parse as a version pin—use --with "pkg==1.2.3" instead. (This mismatch is also discussed in uv’s issue tracker.) [4]

Sources: uv CLI reference [1], uv “Using tools” guide [2], uv dependency specifiers (PEP 508) docs [3], GitHub issue discussion [4].


Fix uvx version specifier syntax.

uvx version pinning uses either @ for the direct command form (e.g., uvx codespell@2.4.1) or PEP 508 specifiers with the --from flag (e.g., uvx --from 'codespell==2.4.1' codespell). The current form $(UVX) codespell==$(CODESPELL_VER) mixes both approaches and will not work. Use either $(UVX) codespell@$(CODESPELL_VER) or $(UVX) --from 'codespell==$(CODESPELL_VER)' codespell.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Makefile` around lines 382 - 383, The Makefile target verify-codespell
currently uses an invalid UVX version specifier "(UVX)
codespell==$(CODESPELL_VER)"; update the invocation in the verify-codespell
recipe to use a valid UVX pinning form — either call UVX with the direct command
form $(UVX) codespell@$(CODESPELL_VER) or use the PEP 508 form $(UVX) --from
'codespell==$(CODESPELL_VER)' codespell — referencing the verify-codespell
target and the UVX and CODESPELL_VER variables when making the change.


.PHONY: run-gitlint
run-gitlint: $(GITLINT)
run-gitlint:
ifdef PULL_BASE_SHA
@echo "Linting commits from $(PULL_BASE_SHA) to $(PULL_PULL_SHA) (CI: PR targeting $(PULL_BASE_SHA))"
@$(GITLINT) --commits $(PULL_BASE_SHA)..$(PULL_PULL_SHA)
@$(UVX) gitlint-core==$(GITLINT_VER) --commits $(PULL_BASE_SHA)..$(PULL_PULL_SHA)
else
$(eval MERGE_BASE := $(shell \
git merge-base HEAD origin/HEAD 2>/dev/null || \
Expand All @@ -400,7 +395,7 @@ else
echo "HEAD~1" \
))
@echo "Linting commits from $(MERGE_BASE) to HEAD (local development)"
@$(GITLINT) --commits $(MERGE_BASE)..HEAD
@$(UVX) gitlint-core==$(GITLINT_VER) --commits $(MERGE_BASE)..HEAD
endif

.PHONY: cpo-container-sync
Expand All @@ -420,22 +415,3 @@ karpenter-upstream-e2e:
## Tooling Binaries
## --------------------------------------

##@ codespell
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;

##@ gitlint
gitlint : $(GITLINT) ## Install local copy of gitlint
$(GITLINT): $(TOOLS_DIR)/go.mod
mkdir -p $(TOOLS_BIN_DIR); \
mkdir -p $(TOOLS_BIN_DIR)/$(GITLINT_DIST_DIR); \
pip install --target=$(TOOLS_BIN_DIR)/$(GITLINT_DIST_DIR) gitlint==$(GITLINT_VER) --upgrade; \
cp $(TOOLS_BIN_DIR)/$(GITLINT_DIST_DIR)/bin/$(GITLINT_BIN) $(TOOLS_BIN_DIR)/$(GITLINT_DIST_DIR)/$(GITLINT_BIN)-bin; \
chmod +x $(TOOLS_BIN_DIR)/$(GITLINT_DIST_DIR)/$(GITLINT_BIN)-bin;