See the release blog post for more, including detailed descriptions of any newly added rules.
What's Changed
Highlights include: experimental support for linting Jupyter Notebooks.
To opt-in to linting Jupyter Notebook files, add the *.ipynb
pattern to your include
setting, like so:
[tool.ruff]
# Allow Ruff to discover `*.ipynb` files.
include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
This will prompt Ruff to discover Jupyter Notebook files in any specified directories, and lint them
accordingly.
Jupyter Notebook support is currently opt-in and experimental. We'd love your help testing it out.
Have feedback? Run into issues? Let us know!
New Rules
- [
flake8-pyi
] ImplementPYI002
,PYI003
,PYI004
,PYI005
by @density in #5457 - [
numpy
] Implementnumpy-deprecated-function
(NPY003
) by @charliermarsh in #5468 - [
perflint
] Implementunnecessary-list-cast
(PERF101
) by @qdegraaf in #5121 - [
perflint
] Implementtry-except-in-loop
(PERF203
) by @evanrittenhouse in #5166 - [
perflint
] Implementmanual-list-comprehension
(PERF401
) andmanual-list-copy
(PERF402
) rules by @qdegraaf in #5298 - [
pylint
] Implement Pylintsingle-string-used-for-slots
(C0205
) assingle-string-slots
(PLC0205
) by @tjkuson in #5399
Jupyter
- Experimental release for Jupyter notebook integration by @dhruvmanila in #5363
- Enable --watch for Jupyter notebooks by @charliermarsh in #5394
- Consider Jupyter index for code frames (
--show-source
) by @dhruvmanila in #5402 - fixup! Consider Jupyter index for code frames (
--show-source
) (#5402) by @dhruvmanila in #5414
Settings
- [
pyupgrade
] Restore thekeep-runtime-typing
setting by @charliermarsh in #5470 - Add
PythonVersion::Py312
by @charliermarsh in #5316
Bug Fixes
- Support
pydantic.BaseSettings
inmutable-class-default
by @charliermarsh in #5312 - Allow
__slots__
assignments inmutable-class-default
by @charliermarsh in #5314 - Avoid syntax errors when removing f-string prefixes by @charliermarsh in #5319
- Ignore unpacking in
iteration-over-set
by @charliermarsh in #5392 - Replace same length equal line with dash line in D407 by @dhruvmanila in #5383
- Exclude docstrings from PYI053 by @intgr in #5405
- Use "manual" fixability for E731 in shadowed context by @charliermarsh in #5430
- Detect consecutive, non-newline-delimited NumPy sections by @charliermarsh in #5467
- Fix
unnecessary-encode-utf8
to fixencode
on parenthesized strings correctly by @harupy in #5478 - Allow
Final
assignments in stubs by @charliermarsh in #5490 - Respect
abc
decorators when classifying function types by @charliermarsh in #5315 - Allow
@Author
format for "Missing Author" rule inflake8-todos
by @mayrholu in #4903 - Ignore type aliases for RUF013 by @dhruvmanila in #5344
- Change W605 autofix to use raw strings if possible by @hauntsaninja in #5352
- Add space when migrating to raw string by @charliermarsh in #5358
- Update the
invalid-escape-sequence
rule by @charliermarsh in #5359 - Include BaseException in B017 rule by @charliermarsh in #5466
- [
flake8-django
] Skip duplicate violations inDJ012
by @charliermarsh in #5469
New Contributors
- @mayrholu made their first contribution in #4903
- @hauntsaninja made their first contribution in #5352
- @ethunk made their first contribution in #5397
- @LouisDISPA made their first contribution in #5475
Full Changelog: v0.0.275...v0.0.276