From 8eaa7c95dc31ce681e010259199466c5ad082390 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Tue, 29 Apr 2025 02:43:11 +0100 Subject: [PATCH 1/4] Create a project-wide ``.ruff.toml`` settings file --- .ruff.toml | 13 +++++++++++++ Doc/.ruff.toml | 5 ++--- Lib/test/.ruff.toml | 3 ++- Tools/build/.ruff.toml | 4 +--- Tools/clinic/.ruff.toml | 3 +-- 5 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 .ruff.toml diff --git a/.ruff.toml b/.ruff.toml new file mode 100644 index 00000000000000..83c90b37470c75 --- /dev/null +++ b/.ruff.toml @@ -0,0 +1,13 @@ +# Default settings for Ruff in CPython + +# PYTHON_FOR_REGEN +target-version = "py310" + +# PEP 8 +line-length = 79 + +# Nicer diagnostic output +output-format = "full" + +# Enable automatic fixes (use ``fix = false`` or ``--no-fix`` to override) +fix = true diff --git a/Doc/.ruff.toml b/Doc/.ruff.toml index 111ce03b91df38..3e676e13c3f41a 100644 --- a/Doc/.ruff.toml +++ b/Doc/.ruff.toml @@ -1,7 +1,6 @@ +extend = "../.ruff.toml" # Inherit the project-wide settings + target-version = "py312" # Align with the version in oldest_supported_sphinx -fix = true -output-format = "full" -line-length = 79 extend-exclude = [ "includes/*", # Temporary exclusions: diff --git a/Lib/test/.ruff.toml b/Lib/test/.ruff.toml index fa8b2b42579b4a..5af88e2f8eeca8 100644 --- a/Lib/test/.ruff.toml +++ b/Lib/test/.ruff.toml @@ -1,4 +1,5 @@ -fix = true +extend = "../../.ruff.toml" # Inherit the project-wide settings + extend-exclude = [ # Excluded (run with the other AC files in its own separate ruff job in pre-commit) "test_clinic.py", diff --git a/Tools/build/.ruff.toml b/Tools/build/.ruff.toml index e4f024333adf1a..c084c06144adaf 100644 --- a/Tools/build/.ruff.toml +++ b/Tools/build/.ruff.toml @@ -1,6 +1,4 @@ -target-version = "py310" -fix = true -line-length = 79 +extend = "../../.ruff.toml" # Inherit the project-wide settings [lint] select = [ diff --git a/Tools/clinic/.ruff.toml b/Tools/clinic/.ruff.toml index c019572d0cb186..5033887df0c1cd 100644 --- a/Tools/clinic/.ruff.toml +++ b/Tools/clinic/.ruff.toml @@ -1,5 +1,4 @@ -target-version = "py310" -fix = true +extend = "../../.ruff.toml" # Inherit the project-wide settings [lint] select = [ From fb22936d93eef87699fe8465645de2ec43d99cb5 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Thu, 1 May 2025 09:21:55 +0100 Subject: [PATCH 2/4] Elaborate Co-authored-by: Alex Waygood --- .ruff.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.ruff.toml b/.ruff.toml index 83c90b37470c75..677f191e350290 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -9,5 +9,7 @@ line-length = 79 # Nicer diagnostic output output-format = "full" -# Enable automatic fixes (use ``fix = false`` or ``--no-fix`` to override) +# Enable automatic fixes by default. +# To override this, use ``fix = false`` in a subdirectory's config file +# or ``--no-fix`` on the CLI fix = true From 322b479cd2f8f7cf1d86ae6fa88e02e51825642f Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Thu, 1 May 2025 09:22:42 +0100 Subject: [PATCH 3/4] Remove redundant setting Co-authored-by: Alex Waygood --- .ruff.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.ruff.toml b/.ruff.toml index 677f191e350290..b893ebca436371 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -6,9 +6,6 @@ target-version = "py310" # PEP 8 line-length = 79 -# Nicer diagnostic output -output-format = "full" - # Enable automatic fixes by default. # To override this, use ``fix = false`` in a subdirectory's config file # or ``--no-fix`` on the CLI From 6d91f12a63eaa51b9be9ab7274ef3145878886e6 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Thu, 1 May 2025 09:23:08 +0100 Subject: [PATCH 4/4] Update .ruff.toml --- .ruff.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruff.toml b/.ruff.toml index b893ebca436371..1c015fa88415bc 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -8,5 +8,5 @@ line-length = 79 # Enable automatic fixes by default. # To override this, use ``fix = false`` in a subdirectory's config file -# or ``--no-fix`` on the CLI +# or ``--no-fix`` on the command line. fix = true