Skip to content

Conversation

SigureMo
Copy link
Member

@SigureMo SigureMo commented Sep 16, 2022

PR types

Others

PR changes

Others

Describe

修复 remove-crlf 和 detect-private-key 两个 hook 配置的 files 字段

@paddle-bot
Copy link

paddle-bot bot commented Sep 16, 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 16, 2022
@@ -3,7 +3,6 @@ repos:
rev: v1.1.14
hooks:
- id: remove-crlf
files: (?!.*third_party)^.*$ | (?!.*book)^.*$
Copy link
Member Author

@SigureMo SigureMo Sep 16, 2022

Choose a reason for hiding this comment

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

这里看起来是想忽略路径中包含 third_party 或者包含 book 的文件,但是这种写法是不正确的,现在所有文件都会被忽略,pre-commit run remove-crlf --all-files 会直接 skip 掉(因为没有任何文件路径匹配得上这一正则)

pre-commit run remove-crlf --all-files      
# CRLF end-lines remover...............................(no files to check)Skipped

即便去掉 | 两侧的空格变成 (?!.*third_party)^.*$|(?!.*book)^.*$ 逻辑也是不对的,那只是「排除了包含 third_party 的路径」以及「排除了包含 book 的路径」的并集,仍然是「所有文件」(严谨点其实是「排除了同时包含 third_partybook 的文件,但我觉得就算是曾经的 Paddle 也不会有这样的路径」)

这里规则的上次改动已经很久远了(6 年前),Paddle 目录结构已经发生了很大改动,目前来看排除这两种路径已经不需要了,因为现有目录结构中没有这样的路径,因此移除这里的 files 字段

由于以前的 remove-crlf 完全处于不工作的状态,所以有一些存量,包含一些 cpp 文件(#46156)、python 文件(#46155)、cuh 文件(在 cuh 修复 PR 中统一修复)、Java 前端相关文件(暂不修复)

下面的 detect-private-key 修改理由完全一致,不过没有存量,无需额外 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 b408e71 into PaddlePaddle:develop Sep 20, 2022
@SigureMo SigureMo deleted the pre-commit-hook-remove-crlf-config-fix branch September 20, 2022 06:49
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