-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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] Support .clang-format-ignore file #52975
Comments
I like this idea, I often have generated files that I don't want to clang-format. (resource.h). I notice clang-power tools has this capability built in. PowerTools |
I too, like this. I was googling for a way to do just that, ignore generated files although they match the pattern |
I was looking online how to ignore formatting for 3rd party code in specific folders and bumped into this issue. +1 for this feature! |
Another case is to exclude 3rd party submodule without polluting it with another .clang-format file just to ignore, +1 from me |
this is exactly why I want this too |
+1 |
I've come up with the following spec for the
Multiple |
Is that intentionally different from how
This appears a little unclear. Does the file override the other file, meaning, all of that other file's patterns are ignored, or are the patterns merged (that would be |
Do we need support for absolute paths? That should be an anti-pattern for code repositories. I'm not against this feature, but I really don't think its that useful resp. one should spent time on implementing it. You want to disable formatting of a single source file? |
Yes.
The former. I've updated the wording in the spec above. |
No, but I need to handle it instead of letting it be skipped silently. Also, I want to match the behavior (more or less) of running
I agree that absolute path patterns are not very useful, but we need to handle it for completeness. BTW, I have already implemented it without much extra work, and it has negligible impact on performance. 🙂
That doesn't always work well in practice. See e.g. #27467. |
I've removed the support for patterns with a trailing slash to simplify the spec and avoid possible confusions. To match all files in a directory, use e.g. |
Update: I'll wrap this up as soon as #76021 is merged. |
An idea split from #27467.
The gist is to be able to specify files that should not be formatted.
It could work in a similar way as .gitignore files (possibly the same syntax).
The text was updated successfully, but these errors were encountered: