-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
commit 时 flake8 报 E501 line too long #50982
Comments
文件会自动修改吧,将修改后的文件add后再提交commit呢 |
文件没有自动修改,反复pre-commit没有效果 |
请问是 Windows 系统嘛?以及 Shell 环境是(如 git bash、powershell、cmd)? |
不好意思忘记提供信息了。 |
我这边没有相关的测试条件,可以麻烦帮忙测试一些可能的修复方案吗?非常感谢! 修改项目根目录 [flake8]
select = C,E,F,W
exclude =
./build,
# A trick to exclude fluid/ but keep fluid/tests/, see more at
# https://github.com/PaddlePaddle/Paddle/pull/46290#discussion_r976392010
./python/paddle/fluid/[!t]**,
./python/paddle/fluid/tra**,
# Exclude third-party libraries
./python/paddle/utils/gast/**,
# Exclude files that will be removed in the future, see more at
# https://github.com/PaddlePaddle/Paddle/pull/46782#issuecomment-1273033731
./python/paddle/fluid/tests/unittests/npu/**,
./python/paddle/fluid/tests/unittests/mlu/**
ignore =
# Whitespace before ‘,’, ‘;’, or ‘:’, it is not compatible with black
E203,
# Module level import not at top of file
E402,
# Line too long (82 > 79 characters)
E501,
# Do not compare types, use `isinstance()`
E721,
# Do not use bare except, specify exception instead
E722,
# Do not assign a lambda expression, use a def
E731,
# Do not use variables named ‘l’, ‘O’, or ‘I’
E741,
# `name` may be undefined, or defined from star imports: `module`
F405,
# Local variable name is assigned to but never used
F841,
# Line break before binary operator, it is not compatible with black
W503
per-file-ignores =
# These files need tabs for testing.
python/paddle/fluid/tests/unittests/dygraph_to_static/test_error.py:E101,W191
python/paddle/fluid/tests/unittests/collective/fleet/test_hdfs1.py:E101,W191
# Ignore unused imports in __init__.py
__init__.py: F401
# Ignore undefined variables in CMake config and some dygraph_to_static tests
.cmake-format.py: F821
python/paddle/fluid/tests/unittests/dygraph_to_static/test_loop.py: F821
python/paddle/fluid/tests/unittests/dygraph_to_static/test_closure_analysis.py: F821 修改项目根目录 - repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
args: ["--config=.flake8"] 之后运行 |
CodeStyle不符合规范,一行代码不要超过80个 |
一些额外的信息:本问题在上周收到 @Liyulingyue 的反馈以及请 @Ainavo 的帮忙测试时都复现了,已经可以确定本问题应该是存在的(均在 Windows 下),问题是 flake8 无法发现项目根目录下的
相关存量暂时不需要修改,这个已经在 config 里 ignore 了,目前的问题是无法读取 config @1099255210 如果是做 Hackathon 等框架开发任务的话,可以尝试申请 AI Studio 框架开发功能~可参考 #45347 |
好的,那我暂时不做修改 |
非常感谢反馈!我会尽快提交修复 PR~ |
请提出你的问题 Please ask your question
pre-commit 和 commit 时都报 flake8 Failed,显示 E501 line too long.
The text was updated successfully, but these errors were encountered: