pyproject.toml 2.6 KB
Newer Older
1 2 3 4
[tool.black]
exclude = "build"
line-length = 80
skip-string-normalization = true
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

[tool.isort]
profile = "black"
line_length = 80
known_first_party = ["paddle"]
skip = ["build", "__init__.py"]
extend_skip_glob = [
    # These files do not need to be formatted,
    # see .flake8 for more details
    "python/paddle/fluid/[!t]**",
    "python/paddle/fluid/tra**",
    "python/paddle/utils/gast/**",
    "python/paddle/fluid/tests/unittests/npu/**",
    "python/paddle/fluid/tests/unittests/mlu/**",
]
20 21 22 23 24 25 26 27 28 29 30 31

[tool.ruff]
exclude = [
    "./build",
    "./python/paddle/fluid/[!t]**",
    "./python/paddle/fluid/tra**",
    "./python/paddle/utils/gast/**",
    "./python/paddle/fluid/tests/unittests/npu/**",
    "./python/paddle/fluid/tests/unittests/mlu/**",
]
target-version = "py37"
select = [
32 33 34
    # Pyflakes
    "F401",

35
    # Comprehensions
36
    "C4",
37

38
    # Pyupgrade
39
    "UP",
40 41 42

    # NumPy-specific rules
    "NPY001",
43 44

    # Bugbear
45 46
    "B002",
    "B003",
47
    "B004",
48 49 50 51
    # "B005",
    # "B006",
    # "B007",
    # "B008",
52 53
    "B009",
    "B010",
54
    "B011",
55 56 57
    "B012",
    "B013",
    "B014",
58
    "B015",
G
gouzil 已提交
59
    "B016",
60 61 62
    # "B017",
    "B018",
    "B019",
63
    "B020",
64 65 66 67 68 69 70 71 72 73 74 75
    "B021",
    "B022",
    # "B023",
    # "B024",
    "B025",
    # "B026",
    # "B027",
    # "B028",
    "B029",
    # "B030",
    "B032",
    # "B904",
76 77

    # Pylint
78
    "PLC0414",
79
    # "PLC1901",
80
    "PLC3002",
81 82 83 84 85 86 87 88
    "PLE0100",
    "PLE0101",
    # "PLE0116",
    # "PLE0117",
    # "PLE0118",
    "PLE0604",
    "PLE0605",
    "PLE1142",
89
    "PLE1205",
90 91 92 93 94 95 96 97 98 99 100 101
    "PLE1206",
    "PLE1307",
    # "PLE1310",
    # "PLE1507",
    "PLE2502",
    # "PLE2510",
    # "PLE2512",
    # "PLE2513",
    # "PLE2514",
    # "PLE2515",
    # "PLR0133",
    # "PLR0206",
102
    "PLR0402",
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
    # "PLR0911",
    # "PLR0912",
    # "PLR0913",
    # "PLR0915",
    # "PLR1701",
    # "PLR1711",
    # "PLR1722",
    # "PLR2004",
    # "PLR5501",
    # "PLW0120",
    # "PLW0129",
    # "PLW0602",
    # "PLW0603",
    # "PLW0711",
    # "PLW1508",
    # "PLW2901",
119 120 121 122
]
unfixable = [
    "NPY001"
]
123 124 125 126 127 128
ignore = [
    # It not met the "Explicit is better than implicit" rule
    "UP015",
    # It will cause the performance regression on python3.10
    "UP038",
]
129 130

[tool.ruff.per-file-ignores]
131
# Ignore unused imports in __init__.py
132
"__init__.py" = ["F401"]
133
# Ignore version check in setup.py
134
"setup.py" = ["UP036"]
135 136
# Ignore unnecessary comprehension in dy2st unittest test_loop
"python/paddle/fluid/tests/unittests/dygraph_to_static/test_loop.py" = ["C416"]
137
# Ignore unnecessary lambda in dy2st unittest test_lambda
138
"python/paddle/fluid/tests/unittests/dygraph_to_static/test_lambda.py" = ["PLC3002"]