-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[CodeStyle] fix cpplint hook not working on CI #46136
[CodeStyle] fix cpplint hook not working on CI #46136
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
|
||
exit $TOTAL_ERRORS | ||
cpplint $@ |
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.
相关参数写在 pre-commit-config.yaml
里,以便维护,本 hook 仅做安装 + 调用
@@ -47,6 +47,10 @@ repos: | |||
entry: bash ./tools/codestyle/cpplint_pre_commit.hook | |||
language: system | |||
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx)$ | |||
args: | |||
- --extensions=c,cc,cxx,cpp,cu,cuh,h,hpp,hxx,kps |
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.
默认 extensions 无法处理 kps,因此将 kps 后缀添加到 --extensions
参数,不过因为现在 files
字段没有传入 kps 文件,因此还不会检测 kps 文件,如果需要检测的话,在 files
字段加入 kps 即可
args: | ||
- --extensions=c,cc,cxx,cpp,cu,cuh,h,hpp,hxx,kps | ||
- --filter=-readability/fn_size,-build/include_what_you_use,-build/c++11,-whitespace/parens | ||
- --quiet |
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.
cpplint 默认行为是所有传入的文件都会打印 Done processing <file_path>
,使用 --quiet
参数可以避免打印 Success 了的文件信息(Failed 还会打印),使得 log 更加清晰
@@ -35,6 +35,7 @@ namespace distributed { | |||
} | |||
|
|||
int32_t GraphBrpcServer::Initialize() { | |||
// do some change |
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.
修改后可以触发 CI 上 pre-commit 的拦截,流水线见 https://xly.bce.baidu.com/paddlepaddle/paddle/newipipe/detail/6641390/job/18513668
This reverts commit 8958534.
请解决下冲突,可以使用test=document_fix来加速CI |
冲突已解决 |
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.
LGTM
PR types
Others
PR changes
Others
Describe
修复 cpplint hook 在 CI 上不 work 的问题(详情见 #46102),以尽快阻止增量问题,存量问题由修改相关文件触发问题的 RD 处理(๑><๑)
存量问题统计
所有文件(含 cuh,不含 kps),(log 见 cpplint.log)的统计如下:
可以看出主要是分布式相关(
distributed
、fleet
)的问题比较多,其余文件大多只有一两个问题,在修改相关文件时一并修复即可仅 kps 文件,(log 见 cpplint-kps-only.log)的统计如下: