diff --git a/.flake8 b/.flake8 index 04362f87da7e9bf7ecfd78565461f56c60b9d852..7573178348318db0afa26b291c9dc16a997f5a79 100644 --- a/.flake8 +++ b/.flake8 @@ -5,7 +5,15 @@ exclude = # 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** + ./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 E121,E122,E123,E125,E126,E127,E128,E129,E131, @@ -60,11 +68,7 @@ per-file-ignores = python/paddle/metric/*:F401 python/paddle/fluid/tests/unittests/ir/*:F401 python/paddle/fluid/tests/unittests/tokenizer/*:F401 - python/paddle/fluid/tests/unittests/xpu/*:F401 python/paddle/fluid/tests/unittests/distribution/*:F401 - python/paddle/fluid/tests/unittests/mlu/*:F401 - python/paddle/fluid/tests/unittests/npu/*:F401 - python/paddle/fluid/tests/unittests/ipu/*:F401 python/paddle/fluid/tests/unittests/distributed_passes/*:F401 python/paddle/fluid/tests/unittests/auto_parallel/*:F401 python/paddle/fluid/tests/unittests/dygraph_to_static/*:F401 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 55c1f98a5beba85ed58f64c810843e1e75872e69..fda8a37c2ec00ac892700b12211526f56a27f2f8 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,10 +1,13 @@ -# Exclude all third-party libraries globally +# Exclude all third-party libraries and auto-generated files globally exclude: | (?x)^( patches/.+| paddle/fluid/framework/fleet/heter_ps/cudf/.+| paddle/fluid/distributed/ps/thirdparty/round_robin.h| - python/paddle/utils/gast/.+ + python/paddle/utils/gast/.+| + .+_py2\.py| + python/paddle/fluid/tests/unittests/npu/.+| + python/paddle/fluid/tests/unittests/mlu/.+ )$ repos: - repo: https://github.com/Lucas-C/pre-commit-hooks.git