-
-
Notifications
You must be signed in to change notification settings - Fork 8
fix: parse clang-tidy output when WarningsAsErrors is asserted
#162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ref cpp-linter/cpp-linter-action#347 Basically, we just needed to account for the `,-warnings-as-errors` appended to the rule name in square brackets. ### Without `WarningsAsErrors` ```text tests/demo/demo.cpp:2:1: error: included header demo.hpp is not used directly [misc-include-cleaner] ``` ### With `WarningsAsErrors` ```text tests/demo/demo.cpp:2:1: error: included header demo.hpp is not used directly [misc-include-cleaner,-warnings-as-errors] ```
WalkthroughUpdates repository settings and tests: extends text normalization in .gitattributes, broadens a clang-tidy note header regex in the Python linter tool, adds a type-ignore in a test, and sets all Clang-Tidy warnings as errors in the demo configuration. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. 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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/capture_tools_output/test_tools_output.py (1)
458-458: Prefer precise typing over a blanket type ignoreIf the mypy complaint is about
diff’s type, consider casting to the expected pygit2 type instead of ignoring the arg type altogether.Apply this minimal change if it satisfies the checker:
- repo.apply(diff, pygit2.GIT_APPLY_LOCATION_BOTH) # type: ignore[arg-type] + repo.apply(cast(pygit2.Diff, diff), pygit2.GIT_APPLY_LOCATION_BOTH)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.gitattributes(1 hunks)cpp_linter/clang_tools/clang_tidy.py(1 hunks)tests/capture_tools_output/test_tools_output.py(1 hunks)tests/demo/.clang-tidy(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: test (ubuntu-latest, 19)
- GitHub Check: test (ubuntu-latest, 17)
- GitHub Check: test (ubuntu-latest, 15)
- GitHub Check: test (ubuntu-latest, 9)
- GitHub Check: test (ubuntu-latest, 12)
- GitHub Check: test (ubuntu-latest, 16)
- GitHub Check: test (ubuntu-latest, 18)
- GitHub Check: test (ubuntu-latest, 11)
- GitHub Check: test (ubuntu-latest, 14)
- GitHub Check: test (ubuntu-latest, 10)
- GitHub Check: test (ubuntu-latest, 13)
- GitHub Check: test (windows-latest, 10)
- GitHub Check: test (ubuntu-latest, 20)
- GitHub Check: test (ubuntu-latest, 21)
- GitHub Check: test (windows-latest, 14)
- GitHub Check: test (windows-latest, 15)
- GitHub Check: test (windows-latest, 13)
- GitHub Check: test (windows-latest, 18)
- GitHub Check: test (windows-latest, 17)
- GitHub Check: test (windows-latest, 19)
🔇 Additional comments (3)
tests/demo/.clang-tidy (1)
3-3: Demo config: enabling WarningsAsErrors is appropriate for exercising the parserThis will force clang-tidy to emit
[<check>,-warnings-as-errors], which is exactly what the updated parser targets. Looks good..gitattributes (1)
14-16: Normalize additional text files to LF — good hardeningLock files and Git metadata benefit from consistent EOLs across platforms. Change is safe and reduces flaky diffs.
cpp_linter/clang_tools/clang_tidy.py (1)
13-15: Adopt the non-greedy named-group regex Verified against sample lines—including Windows paths and-warnings-as-errorssuffix—ensuring correct captures.
| --- | ||
| Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,performance-*,bugprone-*,clang-analyzer-*,mpi-*,misc-*,readability-*' | ||
| WarningsAsErrors: '' | ||
| WarningsAsErrors: '*' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, this would cause a test failure (tests/capture_tools_output/test_database_path.py::test_ninja_database).
Now all is well with the change in RegEx pattern.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #162 +/- ##
=======================================
Coverage 98.26% 98.26%
=======================================
Files 23 23
Lines 1899 1899
=======================================
Hits 1866 1866
Misses 33 33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ref cpp-linter/cpp-linter-action#347
Basically, we just needed to account for the
,-warnings-as-errorsappended to the rule name in square brackets.Without
WarningsAsErrorsWith
WarningsAsErrorsSummary by CodeRabbit