Skip to content

feat(clang-tidy): add --fix opt-in flag for auto-applying fixes in place#206

Open
Copilot wants to merge 2 commits intomainfrom
copilot/add-auto-fix-support-clang-tidy
Open

feat(clang-tidy): add --fix opt-in flag for auto-applying fixes in place#206
Copilot wants to merge 2 commits intomainfrom
copilot/add-auto-fix-support-clang-tidy

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 5, 2026

The clang-tidy hook only reported issues; unlike clang-format it never modified files. This adds an opt-in --fix flag that passes -fix to clang-tidy.

Changes

  • clang_tidy.py

    • New --fix parser argument; appends -fix to the clang-tidy invocation when set
    • Extended unsafe_parallel guard to cover -fix and -fix-errors (parallel runs risk concurrent writes to shared headers)
    • Serial path now uses clang_tidy_args + source_files instead of raw other_args, so injected flags are always forwarded
  • tests/test_clang_tidy.py — three new unit tests:

    • --fix appends -fix to the command
    • --fix forces serial execution even with --jobs > 1
    • Direct -fix-errors in args also forces serial execution
  • README.md — documents --fix, notes -fix-errors as a clang-tidy native alternative, and warns that parallelism is automatically disabled when either flag is active

Usage

- id: clang-tidy
  args: [--checks=.clang-tidy, --fix]

-fix-errors (for files with compiler errors) can be passed directly as a native clang-tidy flag. Both flags force serial execution automatically.

Copilot AI linked an issue Apr 5, 2026 that may be closed by this pull request
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 5, 2026

Copilot AI changed the title [WIP] Add auto-fix support for clang-tidy feat(clang-tidy): add --fix opt-in flag for auto-applying fixes in place Apr 5, 2026
Copilot AI requested a review from shenxianpeng April 5, 2026 21:15
@github-actions github-actions bot added bug Something isn't working documentation Improvements or additions to documentation labels Apr 6, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.70%. Comparing base (c1c3116) to head (218b369).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #206      +/-   ##
==========================================
+ Coverage   96.64%   96.70%   +0.05%     
==========================================
  Files           4        4              
  Lines         179      182       +3     
==========================================
+ Hits          173      176       +3     
  Misses          6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 6, 2026

Merging this PR will not alter performance

✅ 63 untouched benchmarks
⏩ 13 skipped benchmarks1


Comparing copilot/add-auto-fix-support-clang-tidy (218b369) with main (c1c3116)

Open in CodSpeed

Footnotes

  1. 13 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@shenxianpeng shenxianpeng marked this pull request as ready for review April 6, 2026 03:34
@shenxianpeng
Copy link
Copy Markdown
Member

@copilot enable autofix_prs to pre-commit.ci by default

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 6, 2026

@copilot enable autofix_prs to pre-commit.ci by default

autofix_prs: true is already present in .pre-commit-config.yaml under the ci: block, so pre-commit.ci will automatically open fix PRs by default — no change needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-fix Support for clang-tidy

2 participants