Skip to content

fix quickstyle: run golangci-lint in the repo you invoked it from - #117

Open
vikin91 wants to merge 1 commit into
masterfrom
piotr/quickstyle-lint-this-clone
Open

fix quickstyle: run golangci-lint in the repo you invoked it from#117
vikin91 wants to merge 1 commit into
masterfrom
piotr/quickstyle-lint-this-clone

Conversation

@vikin91

@vikin91 vikin91 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Description

If you keep two StackRox checkouts next to each other (stackrox and stackrox2) and run quickstyle in the second one, golangci-lint can report files as if they lived in the first checkout:

../stackrox/central/cluster/datastore/datastore_impl.go

StackRox turns the wrapcheck linter off for paths that start with central/. A path that starts with ../stackrox/ does not, so quickstyle prints a wall of wrapcheck errors that make golangci-lint in the same repo does not.

The reason is the argument we passed. quickstyle used to call golangci-lint with a full filesystem path:

golangci-lint run /Users/you/src/github.com/stackrox/stackrox2/central/cluster/datastore

StackRox make golangci-lint does this instead:

golangci-lint run ./central/cluster/datastore

This change cds into the checkout where you ran quickstyle and strips that checkout's directory off the package list, so the invocation matches make golangci-lint in that clone. Findings then look like central/cluster/datastore/foo.go, and the existing skip rules apply.

AI-Assisted: cursor, generated the golangci-lint invocation change; user reviewed.

How I validated my change

Ran quickstyle from a second StackRox clone after editing a file under central/. golangci-lint reported 0 issues instead of wrapcheck errors on datastore_impl.go.

quickstyle passed absolute package dirs. With two clones next to each
other, golangci-lint reported ../sibling/central/... so wrapcheck
exclusions like ^central/ did not match. cd to gitroot and strip that
prefix so the invocation matches make golangci-lint in this clone.

User request: fix the wrapcheck false positives in quickstyle (workflow
repo), not in stackrox .golangci.yml.

Partially generated by AI.

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: e80ead08-5667-424a-8952-1da27b2d7fb5

📥 Commits

Reviewing files that changed from the base of the PR and between da029b0 and 4603122.

📒 Files selected for processing (1)
  • scripts/dev/quickstyle.sh

Included review availability: Your plan provides up to 12 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Improved the gostyle development command to run consistently from the repository root.
    • Updated package path handling to better match CI behavior.

Walkthrough

The quickstyle script now runs golangci-lint from the repository root and passes repository-relative Go directories.

Changes

Lint execution

Layer / File(s) Summary
Repository-relative lint invocation
scripts/dev/quickstyle.sh
The golangci-lint command changes to gitroot before execution and uses repository-relative Go directory arguments.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 46031

This localized change makes quickstyle run golangci-lint against the checked-out repository paths, with no actionable merge-blocking risk remaining after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: running golangci-lint from the repository where quickstyle was invoked.
Description check ✅ Passed The description directly explains the sibling-checkout path issue, the invocation change, the alignment with make golangci-lint, and the validation performed.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch piotr/quickstyle-lint-this-clone

Comment @coderabbitai help to get the list of available commands.

@vikin91 vikin91 changed the title fix quickstyle: run golangci-lint from the checked-out repo fix quickstyle: run golangci-lint in the repo you invoked it from Aug 25, 2026
@vikin91
vikin91 marked this pull request as ready for review August 25, 2026 09:53
@vikin91
vikin91 requested a review from janisz August 25, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant