Skip to content

Commit

Permalink
Merge pull request SCons#4548 from Repiteo/ruff
Browse files Browse the repository at this point in the history
Replace `black`/`flake8` with `ruff`
  • Loading branch information
bdbaddog authored Jun 28, 2024
2 parents 9e8161a + ed251e7 commit 80e5b0c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 27 deletions.
22 changes: 0 additions & 22 deletions .flake8

This file was deleted.

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

From Raymond Li:
- Fix issue #3935: OSErrors are now no longer hidden during execution of
Expand Down
3 changes: 3 additions & 0 deletions RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ DEVELOPMENT
The repo-wide line-ending is now `lf`, with the exception of a few
Windows-only files using `crlf` instead. Any files not already fitting
this format have been explicitly converted.
- Repository linter/formatter changed from flake8/black to ruff, as the
latter grants an insane speed boost without compromising functionality.
Existing settings were migrated 1-to-1 where possible.
- The test runner now recognizes the unittest module's return code of 5,
which means no tests were run. SCons/Script/MainTests.py currently
has no tests, so this particular error code is expected - should not
Expand Down
29 changes: 24 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,30 @@ dist-dir = "build/dist"
[tool.distutils.bdist_wheel]
dist-dir = "build/dist"

# for black and mypy, set the lowest Python version supported
[tool.black]
quiet = true
target-version = ['py36']
skip-string-normalization = true
[tool.ruff]
target-version = "py37" # Lowest python version supported
extend-include = ["SConstruct", "SConscript"]
extend-exclude = [
"bench",
"bin",
"doc",
"src",
"template",
"test",
"testing",
"timings",
"SCons/Tool/docbook/docbook-xsl-1.76.1",
"bootstrap.py",
"runtest.py",
]

[tool.ruff.format]
quote-style = "preserve" # Equivalent to black's "skip-string-normalization"

[tool.ruff.lint.per-file-ignores]
"SCons/Util/__init__.py" = [
"F401", # Module imported but unused
]

[tool.mypy]
python_version = "3.8"

0 comments on commit 80e5b0c

Please sign in to comment.