-
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] Ruff upgrade and addition of paddle.base
check
#57367
Comments
paddle.base
check
认领30 |
认领 31 32 |
认领 7-9 |
认领 No.5: PLR1701 relevant PR: #57391 |
认领35-37 |
认领 38、39 |
意向认领 task 26, 27, 28 @liyongchao911 如果你还在这些任务上,还请你回复一下 |
OK! |
[CodeStyle] Ruff upgrade and addition of paddle.base check 已全部完成,感谢参与的小伙伴们!
欢迎继续参与快乐开源的其他任务! |
任务背景
我们已经在 #46039、#51729 等分别引入了 Flake8、isort、Ruff 等代码检查工具,但当时因为
python/paddle/fluid
下存在大量代码风格较差的历史遗留代码,因此这些工具的引入都没监控 fluid 目录,而经过近一年的 fluid 清理之后,我们终于已经在 #56576 彻底将 fluid 遗留代码清除,并将剩余核心代码 rename 到 base 下。而这部分剩余的核心代码是需要监控的(即python/paddle/base
下的)。本任务主要包含两部分,一部分是 Ruff 工具常规升级,另一部分是移除 Ruff、isort、Flake8 配置中对
python/paddle/base
的 ignore,使该目录也列入代码风格监控之列。⭐️ 提交PR标题 ⭐️:
[CodeStyle][task $N] enable $TOOL $ERRNO rule in python/paddle/base
$N
代表任务序号,$TOOL
代表工具名(Ruff
、isort
、Flake8
其一),$ERRNO
代表错误码,比如任务 3 标题为[CodeStyle][task 3] enable Ruff PLR1711 rule in python/paddle/base
@gouzil
,并链接本 issue#57367
,会由任务 Leader @gouzil 进行任务一审,一审通过后由 @SigureMo 进行二审整体进度(39/39)
✅ ruff
删除
ignore
中的./python/paddle/base/**
选项的错误码,并修复已存在的所有检查任务说明
对应文件
pyproject.toml
base存量: 在
tool.ruff.per-file-ignores
下删除对应的错误码"python/paddle/base/**" = [ - "F401", ... "PLC0414", ]
升级存量:解开
select
中的注释base存量:在
tool.ruff.per-file-ignores
下删除所有错误码常用命令
相关文档
flake8
删除
per-file-ignores
中的# tmp ignore
下对应的错误码,并修复已存在的所有检查任务说明
删除
.flake8
文件中删除对应的错误码per-file-ignores = # These files need tabs for testing. test/dygraph_to_static/test_error.py:E101,W191 # temp ignore base directory python/paddle/base/*: E713, - E712, E266, E714
常用命令
相关文档
✅ isort
需要等待
F401
引入完成后操作F401
完成extend_skip_glob = [ # These files do not need to be formatted, # see .flake8 for more details - "python/paddle/base/**", "python/paddle/utils/gast/**", ]
手动触发自动修复
isort python/paddle/base/ # 或者 isort ./
The text was updated successfully, but these errors were encountered: