Skip to content

Conversation

SigureMo
Copy link
Member

@SigureMo SigureMo commented Sep 15, 2022

PR types

Others

PR changes

Others

Describe

修改 pre-commit 配置,增加 hook 和 yaml 文件

@paddle-bot
Copy link

paddle-bot bot commented Sep 15, 2022

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added contributor External developers status: proposed labels Sep 15, 2022
@SigureMo SigureMo changed the title [CodeStyle] adjust trailing whitespace hook config [WIP][CodeStyle] adjust trailing whitespace hook config Sep 15, 2022
@SigureMo SigureMo changed the title [WIP][CodeStyle] adjust trailing whitespace hook config [CodeStyle] adjust trailing whitespace hook config Sep 15, 2022
exclude: |
(?x)^(
patches/.+
)$
Copy link
Member Author

Choose a reason for hiding this comment

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

直接全局排除掉这些文件,避免每个 hook 下都写一遍

参考:.pre-commit-config.yaml - top level

@@ -26,7 +30,7 @@ repos:
- id: sort-simple-yaml
files: (api|backward|api_[a-z_]+)\.yaml$
- id: trailing-whitespace
files: (.*\.(py|bzl|md|rst|c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps|cmake)|BUILD|.*\.BUILD|WORKSPACE|CMakeLists.txt)$
files: (.*\.(py|bzl|md|rst|c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps|cmake|yaml|hook)|BUILD|.*\.BUILD|WORKSPACE|CMakeLists\.txt)$
Copy link
Member Author

Choose a reason for hiding this comment

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

这里是正则语法,. 是通配符,虽然 CMakeLists.txt 没啥问题,但明显 CMakeLists\.txt 更严谨些

@SigureMo SigureMo changed the title [CodeStyle] adjust trailing whitespace hook config [CodeStyle] trailing whitespace hook for .hook and .yaml Sep 15, 2022
@luotao1 luotao1 self-assigned this Sep 16, 2022
@@ -26,7 +30,7 @@ repos:
- id: sort-simple-yaml
files: (api|backward|api_[a-z_]+)\.yaml$
- id: trailing-whitespace
files: (.*\.(py|bzl|md|rst|c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps|cmake)|BUILD|.*\.BUILD|WORKSPACE|CMakeLists.txt)$
files: (.*\.(py|bzl|md|rst|c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps|cmake|yaml|yml|hook)|BUILD|.*\.BUILD|WORKSPACE|CMakeLists\.txt)$
Copy link
Member Author

Choose a reason for hiding this comment

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

增加了 yml 后缀的 yaml 文件,为 GitHub issue form 模板,trailing whitespace 不会影响渲染效果,存量也在相应 PR 修复

Copy link
Contributor

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

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

LGTM

@luotao1 luotao1 merged commit 8fda830 into PaddlePaddle:develop Sep 19, 2022
@SigureMo SigureMo deleted the trailing-whitespace-increment branch September 19, 2022 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants