Skip to content

Commit f75fc9a

Browse files
webknjazAlexWaygoodhugovkAA-Turner
authored
[3.13] Lint: Create a project-wide .ruff.toml settings file (GH-133124) (#137670)
Co-authored-by: Alex Waygood <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Adam Turner <[email protected]>
1 parent 7e4afe0 commit f75fc9a

File tree

5 files changed

+59
-6
lines changed

5 files changed

+59
-6
lines changed

.ruff.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Default settings for Ruff in CPython
2+
3+
# PYTHON_FOR_REGEN
4+
target-version = "py310"
5+
6+
# PEP 8
7+
line-length = 79
8+
9+
# Enable automatic fixes by default.
10+
# To override this, use ``fix = false`` in a subdirectory's config file
11+
# or ``--no-fix`` on the command line.
12+
fix = true

Doc/.ruff.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
extend = "../.ruff.toml" # Inherit the project-wide settings
2+
13
target-version = "py312" # Align with the version in oldest_supported_sphinx
2-
fix = true
3-
output-format = "full"
4-
line-length = 79
54
extend-exclude = [
65
"includes/*",
76
# Temporary exclusions:

Lib/test/.ruff.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
fix = true
1+
extend = "../../.ruff.toml" # Inherit the project-wide settings
2+
23
target-version = "py312"
4+
35
extend-exclude = [
46
# Excluded (run with the other AC files in its own separate ruff job in pre-commit)
57
"test_clinic.py",

Tools/build/.ruff.toml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
extend = "../../.ruff.toml" # Inherit the project-wide settings
2+
3+
[per-file-target-version]
4+
"deepfreeze.py" = "py311" # requires `code.co_exceptiontable`
5+
"stable_abi.py" = "py311" # requires 'tomllib'
6+
7+
[format]
8+
preview = true
9+
docstring-code-format = true
10+
11+
[lint]
12+
select = [
13+
"C4", # flake8-comprehensions
14+
"E", # pycodestyle
15+
"F", # pyflakes
16+
"I", # isort
17+
"ISC", # flake8-implicit-str-concat
18+
"LOG", # flake8-logging
19+
"PGH", # pygrep-hooks
20+
"PT", # flake8-pytest-style
21+
"PYI", # flake8-pyi
22+
"RUF100", # Ban unused `# noqa` comments
23+
"UP", # pyupgrade
24+
"W", # pycodestyle
25+
"YTT", # flake8-2020
26+
]
27+
ignore = [
28+
"E501", # Line too long
29+
"F541", # f-string without any placeholders
30+
"PYI024", # Use `typing.NamedTuple` instead of `collections.namedtuple`
31+
"PYI025", # Use `from collections.abc import Set as AbstractSet`
32+
"UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)`
33+
]
34+
35+
[lint.per-file-ignores]
36+
"{check_extension_modules,freeze_modules}.py" = [
37+
"UP031", # Use format specifiers instead of percent format
38+
]
39+
"generate_{re_casefix,sre_constants,token}.py" = [
40+
"UP031", # Use format specifiers instead of percent format
41+
]

Tools/clinic/.ruff.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
target-version = "py310"
2-
fix = true
1+
extend = "../../.ruff.toml" # Inherit the project-wide settings
32

43
[lint]
54
select = [

0 commit comments

Comments
 (0)