-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[CodeStyle] trailing whitespace hook for .hook and .yaml #46081
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] trailing whitespace hook for .hook and .yaml #46081
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
exclude: | | ||
(?x)^( | ||
patches/.+ | ||
)$ |
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.
直接全局排除掉这些文件,避免每个 hook 下都写一遍
.pre-commit-config.yaml
Outdated
@@ -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)$ |
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.
这里是正则语法,.
是通配符,虽然 CMakeLists.txt
没啥问题,但明显 CMakeLists\.txt
更严谨些
@@ -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)$ |
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.
增加了 yml 后缀的 yaml 文件,为 GitHub issue form 模板,trailing whitespace 不会影响渲染效果,存量也在相应 PR 修复
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
修改 pre-commit 配置,增加 hook 和 yaml 文件