fix(golangci-lint): restore run wrapper and preserve global-flag rewrites#798
Conversation
|
This PR fixes a regression in the ProblemThe original regression came from shifting That created two distinct problems. 1. Runtime wrapper regression
At the same time, bare That made the public interface inconsistent with the intended contract:
2. Rewrite / discovery regressionsAfter narrowing the compact path to golangci-lint -v run ./...
golangci-lint --color never run ./...That meant hook users could silently fall back to the raw verbose command even though the runtime wrapper explicitly supports those forms. A second bug affected the standard inline syntax: golangci-lint --color=never run ./...
golangci-lint --config=foo.yml run ./...Both the runtime parser and the rewrite/discovery parser normalized FixThis PR is intentionally split into 3 commits, each tightening one part of the behavior: 1. Restore the wrapper contractThe wrapper keeps a single public entrypoint for Only invocations whose first real upstream subcommand is In the filtered path, 2. Restore rewrite/discovery support for pre-
|
📊 Automated PR Analysis
SummaryRestores the golangci-lint run wrapper so that only Review Checklist
Analyzed automatically by wshm · This is an automated analysis, not a human review. |
|
Hey We are cleaning up the codebase and improving the project structure for better onboarding. As part of this effort, PR #826 reorganizes No logic changes — only file moves and import path updates. What you need to doRebase your branch on git fetch origin && git rebase origin/developGit detects renames automatically. If you get import conflicts, update the paths: use crate::git; // now: use crate::cmds::git::git;
use crate::tracking; // now: use crate::core::tracking;
use crate::config; // now: use crate::core::config;
use crate::init; // now: use crate::hooks::init;
use crate::gain; // now: use crate::analytics::gain;Need help rebasing? Tag @aeppling |
c0e8ea8 to
abe0158
Compare
|
Rebased on All checks pass: fmt, clippy (0 errors), 1147 tests green. No import path changes were needed — git detected the renames automatically and applied our commits to the new folder structure. |
abe0158 to
69f909c
Compare
Keep bare golangci-lint invocations as passthrough while preserving compact filtering for golangci-lint run. Update discover/rewrite rules, regression tests, and docs to advertise only the supported compact run path.
Normalize golangci-lint global flags before run during classification and keep them in rewritten commands. Add regression coverage for classify_command and rewrite_command with pre-run global flags.
Handle --flag=value forms consistently in both the runtime parser and discover rewrite logic. Add regression coverage for classify and rewrite paths using inline global flag values before run.
69f909c to
24f2ada
Compare
pszymkowiak
left a comment
There was a problem hiding this comment.
Rebased the branch onto develop since it had drifted 2+ weeks. Had to drop the doc changes to resolve conflicts:
docs/TROUBLESHOOTING.md— deleted on develop (moved todocs/guide/troubleshooting.mdby the docs refacto). Your content tweak was just replacing "golangci-lint" with "golangci-lint run" in one line — trivial to re-apply if needed.docs/FEATURES.md→ now atdocs/usage/FEATURES.md— same kind of trivial text tweak dropped.README.md— took develop's version; the PR change was the same text tweak.
Code changes intact across all 3 commits. Tested locally with a mock golangci-lint:
| Before | After |
|---|---|
rtk golangci-lint version → run --out-format=json version (mangled) |
version (correct passthrough) |
rtk golangci-lint linters → run --out-format=json linters (mangled) |
linters (correct passthrough) |
rtk golangci-lint --version → run --out-format=json --version (mangled) |
--version (correct passthrough) |
rtk golangci-lint run → works |
still works |
rtk golangci-lint --color=never run ./... → ? |
--color=never run ... ./... (flag preserved) |
1408 tests pass, fmt + clippy clean. LGTM.
Summary
This PR fixes a regression in the
golangci-lintwrapper and restores consistency between runtime behavior,discover/rewrite, and the documented compact path.It includes exactly these 3 commits:
fix(golangci-lint): restore run wrapper and align guidancefix(discover): preserve golangci-lint flags in rewritefix(golangci-lint): support inline global flags before runWhat changed
rtk golangci-lintas a single wrapper entrypoint with passthrough for non-runinvocationsrtk golangci-lint run ...discover/rewriteso global flags beforerunare preserved--flag=valuehandling in both runtime parsing and rewrite/discoveryrtk golangci-lint run ...Validation
Targeted checks passed:
rtk cargo test golangci_cmd -- --nocapturertk cargo test discover::registry -- --nocapturertk cargo run -- rewrite 'golangci-lint --color=never run ./...'Local full gate status:
rtk cargo fmt --all --checkpassedrtk cargo clippy --all-targetsreported one existing warning insrc/rake_cmd.rsrtk cargo testin this environment still hits pre-existing tracking DB file failures unrelated to this PR