Skip to content
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

[RFC] Add canonical and standard clang-format rules. #1732

Closed
jroesch opened this issue Sep 19, 2018 · 7 comments
Closed

[RFC] Add canonical and standard clang-format rules. #1732

jroesch opened this issue Sep 19, 2018 · 7 comments

Comments

@jroesch
Copy link
Member

jroesch commented Sep 19, 2018

I have noticed inconsistencies between TVM's style as written today the Google C++ style as formatted by tools such as clang-format.

This proposal is simply a request for us to create a standard clang-format configuration file and apply it uniformly to all code and PRs. We could even set up git-hooks to do this automatically for TVM developers.

Thoughts?

cc @zhiics

@zhiics
Copy link
Member

zhiics commented Sep 19, 2018

I mainly use VIM with the vim-clang-formt plugin. I dumped the .clang-format config file: clang-format -style=google -dump-config > .clang-format

I am not sure how git-hooks can automatically format code. It looks we still need developers to install these tools to comply with the style rules. Or can we do some code style check, like cpplint? But I am not aware of such a tool.

@junrushao
Copy link
Member

Facebook's glow (https://github.com/pytorch/glow) has a clang-format, as well as clang-tidy, maybe we could learn something from them.

@tqchen
Copy link
Member

tqchen commented Jan 8, 2019

Let us act on this, any volunteers?

@zhiics
Copy link
Member

zhiics commented Jan 8, 2019

I think the easiest thing is to add a .clang-format in the project root dir as most of other projects do as @junrushao1994 suggested. If that's what we want I can probably add a simple one to follow Google style: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/.clang-format

@tqchen
Copy link
Member

tqchen commented Jan 8, 2019

that sounds good, @zhiics can you open a PR, we only need to modify a bit in terms of max chars per line(we use 100 chars).

@zhiics
Copy link
Member

zhiics commented Jan 8, 2019

@tqchen NP. Let me do that.

@tqchen
Copy link
Member

tqchen commented Jan 9, 2019

close by #2395

@tqchen tqchen closed this as completed Jan 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants