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

Add cpplint pre-commit hook #9511

Merged
merged 5 commits into from
Mar 30, 2018
Merged

Conversation

wangkuiyi
Copy link
Collaborator

We have many code style problems in even the most recent Fluid code. An example is #9505. I am worried that during the period of performance profiling and tuning, which implies very high pressure to the team, we'd care even less about code style. So I am add cpplint into our pre-commit hook.

Fixes #9510

@wangkuiyi
Copy link
Collaborator Author

I also disabled dropout_op_test in this PR (#9507)

@typhoonzero
Copy link
Contributor

Thought we already have clang-format, and in .clang-format it uses google c++ style to format the code.

@gongweibao
Copy link
Contributor

gongweibao commented Mar 30, 2018

It seems that clang-format use a subset of Google-style and it only does a format and doesn't do a semantic transformation.
Such as (int)a => static_cast<int>(a). @typhoonzero

@wangkuiyi
Copy link
Collaborator Author

clang-format can but can only fix a small fraction of cpplint errors. @typhoonzero

Copy link
Contributor

@helinwang helinwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

TOTAL_ERRORS=0

# The trick to remove deleted files: https://stackoverflow.com/a/2413151
for file in $(git diff --cached --name-status | awk '$1 != "D" {print $2}'); do
Copy link
Contributor

@helinwang helinwang Mar 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So CI won't check cpplint since git diff is clean when running CI. Good idea, so we can turn on CI enforcement later, gradually transition into full cpplint check.

@wangkuiyi wangkuiyi merged commit 767f453 into PaddlePaddle:develop Mar 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants