Skip to content

Commit 80e5b0c

Browse files
authored
Merge pull request SCons#4548 from Repiteo/ruff
Replace `black`/`flake8` with `ruff`
2 parents 9e8161a + ed251e7 commit 80e5b0c

File tree

4 files changed

+28
-27
lines changed

4 files changed

+28
-27
lines changed

.flake8

Lines changed: 0 additions & 22 deletions
This file was deleted.

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
1717
access SCons internals.
1818
- Migrate setup.cfg logic to pyproject.toml; remove setup.cfg.
1919
- Update .gitattributes to match .editorconfig; enforce eol settings.
20+
- Replace black/flake8 with ruff for more efficient formatting & linting.
2021

2122
From Raymond Li:
2223
- Fix issue #3935: OSErrors are now no longer hidden during execution of

RELEASE.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ DEVELOPMENT
116116
The repo-wide line-ending is now `lf`, with the exception of a few
117117
Windows-only files using `crlf` instead. Any files not already fitting
118118
this format have been explicitly converted.
119+
- Repository linter/formatter changed from flake8/black to ruff, as the
120+
latter grants an insane speed boost without compromising functionality.
121+
Existing settings were migrated 1-to-1 where possible.
119122
- The test runner now recognizes the unittest module's return code of 5,
120123
which means no tests were run. SCons/Script/MainTests.py currently
121124
has no tests, so this particular error code is expected - should not

pyproject.toml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,30 @@ dist-dir = "build/dist"
6666
[tool.distutils.bdist_wheel]
6767
dist-dir = "build/dist"
6868

69-
# for black and mypy, set the lowest Python version supported
70-
[tool.black]
71-
quiet = true
72-
target-version = ['py36']
73-
skip-string-normalization = true
69+
[tool.ruff]
70+
target-version = "py37" # Lowest python version supported
71+
extend-include = ["SConstruct", "SConscript"]
72+
extend-exclude = [
73+
"bench",
74+
"bin",
75+
"doc",
76+
"src",
77+
"template",
78+
"test",
79+
"testing",
80+
"timings",
81+
"SCons/Tool/docbook/docbook-xsl-1.76.1",
82+
"bootstrap.py",
83+
"runtest.py",
84+
]
85+
86+
[tool.ruff.format]
87+
quote-style = "preserve" # Equivalent to black's "skip-string-normalization"
88+
89+
[tool.ruff.lint.per-file-ignores]
90+
"SCons/Util/__init__.py" = [
91+
"F401", # Module imported but unused
92+
]
7493

7594
[tool.mypy]
7695
python_version = "3.8"

0 commit comments

Comments
 (0)