-
Notifications
You must be signed in to change notification settings - Fork 452
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
Use clang-format instead of cpplint #979
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes seems in a good direction. Comments inline.
@PragmaTwice Good job! |
I also like this change, cpplint can't auto fix is too frustrate. |
@PragmaTwice Can you help to rebase those commits, I don't know which commit should I start looking. |
@@ -0,0 +1,200 @@ | |||
--- | |||
Language: Cpp | |||
# BasedOnStyle: Google |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generated? Could you share how you gain this config file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cd
to a non-project directoryclang-format-12 -style=google -dump-config > .clang-format
- change
ColumnLimit
to 120
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer ColumnLimit
to 200...Nowadays display device is far wider than 80 or 120 already, and wrap function calls or string literals are really clumsy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old limit is 120, so I just inherit it. I think maybe 200 is not friendly to my small 1080p laptop 🤣 , but I am open for it. What do other guys think about it? cc @git-hulk @torwig @caipengbo @ShooterIT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think 120 is enough, we should rarely have too long lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think 120 is a good decision. Of course, we can use even 200, but 120 makes developers think if the length of the line is more than 120 characters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think 120 is enough.
You can just review three file: |
@PragmaTwice You can squash a bunch of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your updates! Two comments inline.
@torwig I think we're using squash and merge here :) |
@tisonkun Perhaps I'm too old, but I do "squashing" by myself :) |
…into use-clang-format
It closes the clang-format part of #800.
Note: Although it is not recommanded, but developers can disable clang-format for specific code snippets via:
To format code:
To check whether code is formatted:
To use a custom clang-format: