Skip to content
Open
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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ PULL_BASE_SHA := $(if $(PULL_BASE_SHA),$(PULL_BASE_SHA),$(shell git rev-parse ma

.PHONY: api-lint
api-lint: $(GOLANGCI_LINT) $(KUBEAPILINTER_PLUGIN)
cd api && $(GOLANGCI_LINT) run --config ./.golangci.yml --modules-download-mode=readonly -v $(if $(PULL_BASE_SHA),--new-from-rev=$(PULL_BASE_SHA) --whole-files)
cd api && $(GOLANGCI_LINT) run --config ./.golangci.yml --modules-download-mode=readonly -v

.PHONY: api-lint-fix
api-lint-fix: $(GOLANGCI_LINT) $(KUBEAPILINTER_PLUGIN)
cd api && $(GOLANGCI_LINT) run --config ./.golangci.yml --fix -v $(if $(PULL_BASE_SHA),--new-from-rev=$(PULL_BASE_SHA) --whole-files)
cd api && $(GOLANGCI_LINT) run --config ./.golangci.yml --fix -v
Comment on lines 115 to +116

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== relevant files ==\n'
git ls-files 'Makefile' '.pre-commit-config.yaml' | sed 's#^`#-` #'

printf '\n== Makefile excerpt ==\n'
nl -ba Makefile | sed -n '105,125p'

printf '\n== pre-commit excerpt ==\n'
nl -ba .pre-commit-config.yaml | sed -n '30,55p'

Repository: openshift/hypershift

Length of output: 281


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== search for api-lint-fix usage ==\n'
rg -n "api-lint-fix|PULL_BASE_SHA|new-from-rev|whole-files|--fix" -S .

printf '\n== golangci-lint docs/config mentions in repo ==\n'
rg -n "new-from-rev|whole-files|golangci-lint" -S README* docs . 2>/dev/null || true

Repository: openshift/hypershift

Length of output: 50377


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== Makefile lines 120-130 ==\n'
sed -n '120,130p' Makefile | cat -n

printf '\n== .pre-commit-config.yaml lines 37-44 ==\n'
sed -n '37,44p' .pre-commit-config.yaml | cat -n

printf '\n== Makefile api-lint-fix context ==\n'
sed -n '112,118p' Makefile | cat -n

Repository: openshift/hypershift

Length of output: 1445


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== golangci-lint flag docs in vendored source ==\n'
sed -n '120,145p' hack/tools/vendor/github.com/golangci/golangci-lint/v2/pkg/commands/flagsets.go | cat -n

printf '\n== any local docs for api-lint-fix ==\n'
sed -n '1,40p' docs/content/contribute/precommit-hook-help.md | cat -n

Repository: openshift/hypershift

Length of output: 4843


Scope api-lint-fix to the diff. This target ignores PULL_BASE_SHA, so the pre-commit hook can rewrite any file under api/ instead of only the staged change. Pass --new-from-rev=$(PULL_BASE_SHA) --whole-files through here, or split out a separate full-tree fix target.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Makefile` around lines 115 - 116, Update the api-lint-fix target to pass
--new-from-rev=$(PULL_BASE_SHA) --whole-files to the golangci-lint invocation,
ensuring fixes are limited to files changed from the pull request base while
checking complete files. Keep the existing api directory, configuration, fix
mode, and verbosity behavior unchanged.


.PHONY: lint
lint: generate
Expand Down
Loading