Skip to content

fix(clippy): show full error blocks instead of truncated headline#1141

Merged
aeppling merged 1 commit intortk-ai:developfrom
ousamabenyounes:fix/issue-602
Apr 10, 2026
Merged

fix(clippy): show full error blocks instead of truncated headline#1141
aeppling merged 1 commit intortk-ai:developfrom
ousamabenyounes:fix/issue-602

Conversation

@ousamabenyounes
Copy link
Copy Markdown
Contributor

@ousamabenyounes ousamabenyounes commented Apr 10, 2026

Summary

  • Root cause: filter_cargo_clippy collected only the first line of each error (error: ... truncated to 160 chars), discarding the --> location, code snippet (|), and = note:/help: lines that make a compiler error actionable
  • Impact: With -D warnings all warnings become errors — devs saw "cargo clippy: 3 errors, 0 warnings" but no information about what to fix
  • Fix: State-machine collection of full multi-line error blocks (same approach as filter_cargo_build). Each block collects up to 15 lines; up to 10 blocks shown. Warning grouping by lint rule is unchanged.

Before / After

Before:

cargo clippy: 1 errors, 0 warnings
═══════════════════════════════════════

Error details:
  1. error[E0308]: mismatched types

After:

cargo clippy: 1 errors, 0 warnings
═══════════════════════════════════════

Errors:
  error[E0308]: mismatched types
   --> src/main.rs:10:5
    |
 10 |     "hello"
    |     ^^^^^^^ expected `i32`, found `&str`

Test plan

  • test_filter_cargo_clippy_shows_full_error_block — headline + location + code context all shown
  • test_filter_cargo_clippy_multiple_errors_show_all_blocks — both error locations shown
  • All existing test_filter_cargo_clippy_* tests pass (updated section header check: "Errors:" not "Error details:")
  • cargo fmt --all && cargo clippy --all-targets && cargo test --all

Fixes #602

🤖 Generated with Ora Studio

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 10, 2026

CLA assistant check
All committers have signed the CLA.

Previously `filter_cargo_clippy` only captured the first line of each
error diagnostic (truncated to 160 chars), discarding the file location,
code snippet, `^` markers, and `= note:` context that developers need to
actually fix the issue. This made rtk unusable for `cargo clippy -- -D warnings`.

Now errors are collected as full multi-line blocks (up to 15 lines each,
up to 10 errors total), matching the approach used by `filter_cargo_build`.
Warning grouping by lint rule is unchanged.

Fixes rtk-ai#602

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@aeppling
Copy link
Copy Markdown
Contributor

Hey @ousamabenyounes , glad to have you back on RTK repo :)

Fix is clean, allowing 10line of error block which should be enough to display all required informations.

@aeppling aeppling merged commit 95d9d13 into rtk-ai:develop Apr 10, 2026
10 checks passed
@aeppling
Copy link
Copy Markdown
Contributor

Thanks for contributing to filter quality :)

@ousamabenyounes
Copy link
Copy Markdown
Contributor Author

Thanks, really appreciate it!
Glad the fix helps — happy to contribute and improve things here

I’m working on this with my AI agents and a strong focus on quality — this project really matters to me because it brings real value (both economically and environmentally).

Kudos to you for building such a great momentum, and proud to contribute my piece to it !

@aeppling aeppling mentioned this pull request Apr 11, 2026
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.

3 participants