-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
clang-format continues to recurse into directories listed in .clang-format-ignore #114969
Comments
This is expected per the documentation.
We have |
Where in the documentation? - as the behaviour I'm observing is not
explicitly described.
Using the DisableFormat option in a .clang-format file is less than ideal
for the build directory example as the file needs to be generated in the
build process.
…On Wed, 6 Nov 2024 at 15:44, Owen Pan ***@***.***> wrote:
Create a directory with a sub-directory. If we add the first directory
into the ignore list, clang-format will still recurse into the
sub-directory which is not expected.
This is expected per the documentation
<https://clang.llvm.org/docs/ClangFormat.html#clang-format-ignore>.
Reasoning why it's not desirable, if you add a temporary build directory
into the ignore list, clang-format will still format all files in
sub-directories of the build directory.
We have DisableFormat
<https://clang.llvm.org/docs/ClangFormatStyleOptions.html#disableformat>
for that.
—
Reply to this email directly, view it on GitHub
<#114969 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC6KME5RLMXK5YIP6DPTYDZ7F7AZAVCNFSM6AAAAABRGLTDRCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJYGYYTQNRQGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
The linked documentation above specifically mentions and links to POSIX 2.13. It doesn't say that globstar is supported. |
It's not just globstar, as same unexpected behaviour with say find, eg: |
Create a directory with a sub-directory. If we add the first directory into the ignore list, clang-format will still recurse into the sub-directory which is not expected.
Reasoning why it's not desirable, if you add a temporary build directory into the ignore list, clang-format will still format all files in sub-directories of the build directory.
Version: Ubuntu clang-format version 18.1.8 (++20240731024944+3b5b5c1ec4a3-1-exp1-20240731145000.144)
Recreate the directory structure, files, and execute clang-format:
mkdir -p level1/level2 && touch foo.c level1/bar.c level1/level2/bang.c && tree && echo 'level1/*' > .clang-format-ignore && shopt -s globstar && clang-format --verbose **/*
Result, it correctly ignores the file in level1 (bar.c), however continues to recurse into level2 (bang.c) which is not expected.
The text was updated successfully, but these errors were encountered: