Repository navigation
fix: don't drop clang-tidy diagnostics when colors are on - #570
Closed
shenxianpeng wants to merge 1 commit into
Closed
shenxianpeng wants to merge 1 commit into
shenxianpeng wants to merge 1 commit into
Conversation
If `.clang-tidy` sets `UseColor: true`, clang-tidy prints ANSI color codes even when piped, so no line matched NOTE_HEADER and every diagnostic was dropped. Strip the codes from each line before parsing. Fixes #560
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #570 +/- ##
=======================================
Coverage 99.89% 99.89%
=======================================
Files 29 29
Lines 7671 7687 +16
=======================================
+ Hits 7663 7679 +16
Misses 8 8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #560.
If
.clang-tidysetsUseColor: true, clang-tidy prints ANSI color codes even when its stdout is piped. No line then matchedNOTE_HEADER, so every clang-tidy diagnostic was dropped and the run reportedclang-tidy-checks-failed: 0.As suggested in #560,
parse_tidy_output()now strips the color codes from each stdout line before applying the regex. The stripped line is also what gets stored in the notification's suggestion lines.Tests
parse_colored_tidy_outputtest uses real clang-tidy 18 output captured withUseColor: true. It fails on main (no notes parsed) and passes with this change..clang-tidysetsUseColor: true#560:clang-tidy-checks-failedgoes from 0 to 2.