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
Request: Add the .clang-format file to the repository #2703
Comments
I'd like to hear everybody's opinion on this. |
On Montag, 19. Juni 2017 11:18:14 CEST Hartmut Kaiser wrote:
I'd like to hear everybody's opinion on this.
I am in favor of gradually moving to a unified format. I have no particular
preferences. Since automation is pretty decent these days, I think one can
easily adapt.
|
Here are the problems I see (all of which have already been discussed):
the bottom line is that there does not seem to be a solution which has no bad side effects. The only viable application of a .clang-format file would be to use it for new files or for massive edits of older files, which implies for it to be manually used only. Not sure how to enforce this, however. |
You could still not enforce the formatting from the CI side, but recommend to developers to use it. |
@Naios: do the LLVM guys have that written up somewhere as a policy? |
@hkaiser Currently I don't know anything about such a policy in the LLVM project (also my search didn't reveal anything related). |
I do not see how having a .clang-format file in your tree affects rebasing. I have one in mine and I rebase all the time. (rebasing is only affected when files tracked by git are in a modified state) I am in favour of adding the clang-format file to the repo. It should be provided so that as we work on classes we can reformat them as we go. There is no need to reformat the entire code base in one go - our inspect tool already enforces style well enough that existing code is fine. It's nice to be able to format new or edited code using the tool and know that it will pass inspect checks. The clang-format file I'm using can't be used to reformat the whole file as it indents the namespaces too much - but it's fine for sections of code. (I got it from Thomas originally so it's probably the same one as used by others). |
Addressing these points ...
|
I agree on all points.
Addressing these points ...
- if we add a .clang-format to the repository any edit may (will?)
result in a full reformatting of the file
Why? Only when the user says "reformat this file" does that happen. In
my QtCreator, there is an option to automatically run the format too on
save/etc. I have that turned off.
There are in addition pre-commit hooks that format based on the changes
made.
- partial reformats (only the lines touched by an edit) will result in
inconsistent formatting
I think the clang-format generated style is close enough to what's used
that
a) we do not need to worry
b) we are grown up enough to cope with some minor differnces
Exactly. And it's not like all of our files are 100% consistent right now
anyway.
- full reformatting of the whole code base destroys all of the edit
history
Let's not do that then.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2703 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADRl9zbsJXkEKqpGpuYfxlE__tA2qVKks5sF50JgaJpZM4N-j6F>
.
|
@hkaiser It would be really useful, if the HPX project could include the .clang-format file you sent me recently into the main tree, in order to provide official support for clang-format.
It's difficult to work with branches meant for pull requests while keeping an untracked
.clang-format
file, because the config pollutes the working directory which prevents some commonly used git commands like rebasing.Also, an officially supported config could increase the usage of the formatter to get a better and consistently formatted codebase.
The text was updated successfully, but these errors were encountered: