Skip to content

Commit

Permalink
[CodeStyle] update flake8 config (#50458)
Browse files Browse the repository at this point in the history
* update flake8 config

* remove _pb2 from linter ignore list

* refine config

* empty commit, test=document_fix
  • Loading branch information
SigureMo authored Feb 14, 2023
1 parent b85af46 commit c5087da
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
24 changes: 10 additions & 14 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,23 @@ exclude =
# https://github.com/PaddlePaddle/Paddle/pull/46290#discussion_r976392010
./python/paddle/fluid/[!t]**,
./python/paddle/fluid/tra**,
# Exclude auto-generated files
*_pb2.py,
# 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 =
# E, see https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
E203,
E402,
E501,
E721,E722,E731,E741,

# F, see https://flake8.pycqa.org/en/latest/user/error-codes.html
F405,
F841,

# W, see https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
W503
E203, # Whitespace before ‘,’, ‘;’, or ‘:’, it is not compatible with black
E402, # Module level import not at top of file
E501, # Line too long (82 > 79 characters)
E721, # Do not compare types, use `isinstance()`
E722, # Do not use bare except, specify exception instead
E731, # Do not assign a lambda expression, use a def
E741, # Do not use variables named ‘l’, ‘O’, or ‘I’
F405, # `name` may be undefined, or defined from star imports: `module`
F841, # Local variable name is assigned to but never used
W503 # Line break before binary operator, it is not compatible with black
per-file-ignores =
# These files need tabs for testing.
python/paddle/fluid/tests/unittests/dygraph_to_static/test_error.py:E101,W191
Expand Down
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ exclude: |
paddle/fluid/framework/fleet/heter_ps/cudf/.+|
paddle/fluid/distributed/ps/thirdparty/round_robin.h|
python/paddle/utils/gast/.+|
.+_pb2\.py|
python/paddle/fluid/tests/unittests/npu/.+|
python/paddle/fluid/tests/unittests/mlu/.+
)$
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ extend_skip_glob = [
# see .flake8 for more details
"python/paddle/fluid/[!t]**",
"python/paddle/fluid/tra**",
"*_pb2.py",
"python/paddle/utils/gast/**",
"python/paddle/fluid/tests/unittests/npu/**",
"python/paddle/fluid/tests/unittests/mlu/**",
Expand Down

0 comments on commit c5087da

Please sign in to comment.