Skip to content

Add cpplint pre-commit hook#9511

Merged
wangkuiyi merged 5 commits intoPaddlePaddle:developfrom
wangkuiyi:add_hook
Mar 30, 2018
Merged

Add cpplint pre-commit hook#9511
wangkuiyi merged 5 commits intoPaddlePaddle:developfrom
wangkuiyi:add_hook

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)

@wangkuiyi wangkuiyi requested a review from wanglei828 March 29, 2018 23:19
@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.

4 participants