Skip to content
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][Typos] 加入--force-exclude 参数以支持 files.extend-exclude 来忽略对特定文件的 typo 检查 #69530

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

MrXnneHang
Copy link
Contributor

@MrXnneHang MrXnneHang commented Nov 20, 2024

PR Category

User Experience

PR Types

Others

Description

加入--force-exclude 参数以支持 files.extend-exclude 来忽略对特定文件的 typo 检查。

并且以对test/dataset/imikolov_test.py (存在aer的typo error) 进行测试和示例。

之后直接往这个列表里面添加的文件路径即可,所有指定文件将不再进行 typos 检查:

_typos.toml:

extend-exclude = [
    "test/dataset/imikolov_test.py"
]

值得注意的是,在我的机器上进行测试,似乎需要先提交_typos.toml的修改后,才会生效。

(base) xnne@xnne-PC:~/code/yutto-uiya$ git commit -m update
[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /home/xnne/.cache/pre-commit/patch1732073966-67021.
black....................................................................Failed
- hook id: black
- files were modified by this hook

reformatted utils/config.py

All done! ✨ 🍰 ✨
1 file reformatted.

ruff.....................................................................Passed
typos....................................................................Failed
- hook id: typos
- exit code: 2

error: `aer` should be `are`
  --> utils/config.py:31:3
   |
31 | # aer
   |   ^^^
   |

[WARNING] Stashed changes conflicted with hook auto-fixes... Rolling back fixes...
[INFO] Restored changes from /home/xnne/.cache/pre-commit/patch1732073966-67021.
(base) xnne@xnne-PC:~/code/yutto-uiya$ git restore --staged utils/config.py 
(base) xnne@xnne-PC:~/code/yutto-uiya$ git add _typos.toml 
(base) xnne@xnne-PC:~/code/yutto-uiya$ git commit -m update_config_first
[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /home/xnne/.cache/pre-commit/patch1732074019-67272.
black................................................(no files to check)Skipped
ruff.................................................(no files to check)Skipped
typos....................................................................Passed
[INFO] Restored changes from /home/xnne/.cache/pre-commit/patch1732074019-67272.
[gradio-webui 29d481d] update_config_first
 2 files changed, 2 insertions(+), 2 deletions(-)
(base) xnne@xnne-PC:~/code/yutto-uiya$ git add  utils/config.py 
(base) xnne@xnne-PC:~/code/yutto-uiya$ git commit -m test_commit
black....................................................................Passed
ruff.....................................................................Passed
typos....................................................................Passed                                                                               
[gradio-webui f3f8013] test_commit
 1 file changed, 3 insertions(+)

Copy link

paddle-bot bot commented Nov 20, 2024

你的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 the contributor External developers label Nov 20, 2024
@MrXnneHang
Copy link
Contributor Author

MrXnneHang commented Nov 20, 2024

测试示例参见:
image

SigureMo
SigureMo previously approved these changes Nov 20, 2024
Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

LGTMeow 🐾

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants