Skip to content

fix: pass --extra-args to clang-tidy properly#386

Merged
2bndy5 merged 1 commit into
mainfrom
extra-args-fix
Jun 23, 2026
Merged

fix: pass --extra-args to clang-tidy properly#386
2bndy5 merged 1 commit into
mainfrom
extra-args-fix

Conversation

@2bndy5

@2bndy5 2bndy5 commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator
  1. The conversion function was not being used in production code.
  2. clang-tidy was finding the --extra-arg value as an unrecognized option. Prefer using --extra-arg=... instead.

Summary by CodeRabbit

  • Refactor

    • Modified extra argument handling format for clang-tidy invocations.
    • Updated argument processing logic.
  • Tests

    • Updated test assertions to match new argument formatting.
    • Added debug logging for parsed arguments.

1. The conversion function was not being used in production code.
2. clang-tidy was finding the `--extra-arg` value as an unrecognized option. Prefer using `--extra-arg=...` instead.
@2bndy5 2bndy5 added the bug Something isn't working label Jun 23, 2026
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: c9358018-995b-4f35-a5e1-c2d64c189592

📥 Commits

Reviewing files that changed from the base of the PR and between 1f563bb and 7a57580.

📒 Files selected for processing (2)
  • cpp-linter/src/clang_tools/clang_tidy.rs
  • cpp-linter/src/cli/structs.rs

📝 Walkthrough

Walkthrough

The PR changes how clang-tidy --extra-arg values are passed to the subprocess. A new conversion function convert_extra_arg_val is now called when constructing ClangParams.extra_args, and each extra argument is appended to the command as a single --extra-arg={arg} string. A debug log reporting parsed notification count is added, and tests are updated accordingly.

Changes

Extra-arg formatting change

Layer / File(s) Summary
convert_extra_arg_val integration and --extra-arg={arg} invocation
cpp-linter/src/cli/structs.rs, cpp-linter/src/clang_tools/clang_tidy.rs
Imports and applies convert_extra_arg_val when populating ClangParams.extra_args; run_clang_tidy now appends each value as a single cmd.arg(format!("--extra-arg={arg}")) call with explanatory comments, replacing the prior two-token approach.
Debug logging and test updates
cpp-linter/src/clang_tools/clang_tidy.rs
Adds a debug log after parse_tidy_output reporting notes.len(); updates use_extra_args test assertions to match --extra-arg={arg} format and adds a debug println!; renames test_capture to regex_capture.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and concisely summarizes the main change: fixing how --extra-arg options are passed to clang-tidy, which is the core purpose of this PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.56%. Comparing base (36a0d03) to head (7a57580).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #386      +/-   ##
==========================================
+ Coverage   92.54%   92.56%   +0.02%     
==========================================
  Files          23       23              
  Lines        3700     3710      +10     
==========================================
+ Hits         3424     3434      +10     
  Misses        276      276              

☔ View full report in Codecov by Harness.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@2bndy5 2bndy5 marked this pull request as ready for review June 23, 2026 12:50
@2bndy5 2bndy5 merged commit 89f7b3d into main Jun 23, 2026
73 checks passed
@2bndy5 2bndy5 deleted the extra-args-fix branch June 23, 2026 13:01
2bndy5 added a commit that referenced this pull request Jun 23, 2026
Keeping the repo-root path relative breaks parsing of absolute paths in
clang-tidy output.

This didn't surface in the tests because they all use a compilation
database generated for ninja (which uses relative paths). But in the
test repo, we are using CMake which generates absolute paths in the
compilation database.

Remember, clang-tidy outputs filenames however they are stated in the
compilation database. If not using a compilation database, then
clang-tidy just outputs the filename as it was given in the CLI.

I also removed an artifact debug log from developing the solution for
#386

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Improvements**
* Enhanced error handling for repository root paths with improved error
messages when invalid paths are provided.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant