This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Allow newline characters as separators for checks in Clang-Tidy configurations
ClosedPublic

Authored by SimplyDanny on Feb 19 2022, 7:50 AM.

Details

Summary

This is a fix for #53737. In addition to commas, newline characters are considered as separators of checks.

Diff Detail

Event Timeline

SimplyDanny created this revision.Feb 19 2022, 7:50 AM
SimplyDanny requested review of this revision.Feb 19 2022, 7:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 19 2022, 7:50 AM
njames93 added inline comments.Feb 19 2022, 8:59 AM
.clang-tidy
1–10 ↗(On Diff #410088)

This change doesn't belong in this patch.

clang-tools-extra/clang-tidy/GlobList.cpp
30–31
clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
100

This seems like a shortcoming in llvms YAML parser. Isn't the fold character > supposed to replace newlines with spaces and strip trailing ws

"-*,misc-* llvm-* -clang-* google-*"

Using the pipe | instead should yield the output you are currently expecting,

Update according to comments in review

SimplyDanny marked 2 inline comments as done.Feb 19 2022, 1:11 PM
SimplyDanny added inline comments.
clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
100

That's true. > should actually not work without a comma after each check.

SimplyDanny marked an inline comment as done.Feb 19 2022, 1:15 PM
SimplyDanny added inline comments.
clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
100

YAMLParser.h mentions that "Multi-line literal folding" is not yet implemented.

njames93 added inline comments.Feb 19 2022, 4:16 PM
clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
100

So it is, D102590 has been up addressing this very issue (Though its rather stale ATM).
In any case for now we shouldn't depend on the broken behaviour.

HassanElDesouky added inline comments.
clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp
100

Thanks for motivating me to get D102590 to the finish line. I think it's ready now.

What else can be done to get this change approved, @njames93?

Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2022, 2:10 PM
aaron.ballman accepted this revision.Mar 11 2022, 10:07 AM

LGTM, but please wait a day or two before landing in case @njames93 has further concerns.

This revision is now accepted and ready to land.Mar 11 2022, 10:07 AM

LGTM, but please wait a day or two before landing in case @njames93 has further concerns.

Would you merge the changes, @aaron.ballman? Seems like there are no objections from others. Please use the commit details mentioned here.

LGTM, but please wait a day or two before landing in case @njames93 has further concerns.

Would you merge the changes, @aaron.ballman? Seems like there are no objections from others. Please use the commit details mentioned here.

I've commit on your behalf in 2b21fc5520b39fba555f4e5f2480a5651056be84, thank you for the fix!