Skip to content

fix: prettier false positive when not installed (#221)#359

Merged
pszymkowiak merged 3 commits intomasterfrom
fix/prettier-false-positive
Mar 6, 2026
Merged

fix: prettier false positive when not installed (#221)#359
pszymkowiak merged 3 commits intomasterfrom
fix/prettier-false-positive

Conversation

@pszymkowiak
Copy link
Collaborator

Summary

  • Fix bug: rtk prettier --check incorrectly reports "All files formatted correctly" when files need formatting #221: rtk prettier reported "All files formatted correctly" when prettier wasn't installed or produced no output. Now shows the actual error from stderr instead.
  • Smoke tests: Added 49 new assertions to test-all.sh (69 → 118) covering rewrite, verify, proxy, discover, diff, wc, smart, json edge cases, docker, and hook check.
  • Benchmark: Added missing commands to benchmark.sh (cargo, diff, smart, wc, curl, wget), fixed Python/Go commands to use dedicated filters, fixed relative path bug with temp fixture dirs.

Changes

src/prettier_cmd.rs

  • Early exit when prettier produces no stdout and exits non-zero — shows stderr as-is
  • Guard in filter_prettier_output() for empty/whitespace-only input
  • 2 new tests: test_filter_empty_output, test_filter_whitespace_only_output

scripts/test-all.sh

scripts/benchmark.sh

  • Added cargo (build/test/clippy/check), diff, smart, wc, curl, wget sections
  • Fixed Python: rtk ruff check . instead of rtk test ruff check .
  • Fixed Go: rtk golangci-lint run instead of rtk test golangci-lint run, added go build/go vet
  • BENCH_DIR now absolute (fixes debug file writes from temp dirs)
  • Fallback to installed rtk if target/release/rtk not found

Test plan

  • cargo test — all tests pass including 2 new prettier tests
  • cargo clippy — no warnings
  • bash scripts/test-all.sh — 118 assertions
  • bash scripts/benchmark.sh — all sections run

Fixes #221

🤖 Generated with Claude Code

Empty or failed prettier output was incorrectly treated as "all files
formatted". Now detects empty output and non-zero exit code, shows the
actual error message instead of a false positive.
… smart, docker, json edge cases

Covers bug fixes #196, #344, #345, #346, #347 and previously untested
commands. Adds assert_fails helper. 118 assertions total (was 69).
- Add cargo (build/test/clippy/check), diff, smart, wc, curl, wget sections
- Fix Python commands: use dedicated rtk ruff/pytest instead of rtk test
- Fix Go commands: use dedicated rtk go/golangci-lint, add go build/vet
- Make BENCH_DIR absolute so debug files work from temp fixture dirs
- Fallback to installed rtk if target/release/rtk not found
@pszymkowiak pszymkowiak merged commit 85b0b3e into master Mar 6, 2026
2 of 3 checks passed
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.

bug: rtk prettier --check incorrectly reports "All files formatted correctly" when files need formatting

1 participant