ruff/changelogs/0.3.x.md

23 KiB

Changelog 0.3.x

0.3.0

This release introduces the new Ruff formatter 2024.2 style and adds a new lint rule to detect invalid formatter suppression comments.

Preview features

  • `flake8-bandit`
  • `pycodestyle`
  • `pycodestyle`

Rule changes

  • `eradicate`
  • `eradicate`
  • `flake8-boolean-trap`
  • `flake8-copyright`
  • `isort`
  • `pylint`
  • `pylint`
  • `pyupgrade`
  • `ruff`

Formatter

This release introduces the Ruff 2024.2 style, stabilizing the following changes:

  • Prefer splitting the assignment's value over the target or type annotation (#8943)
  • Remove blank lines before class docstrings (#9154)
  • Wrap multiple context managers in with parentheses when targeting Python 3.9 or newer (#9222)
  • Add a blank line after nested classes with a dummy body (...) in typing stub files (#9155)
  • Reduce vertical spacing for classes and functions with a dummy (...) body (#7440, #9240)
  • Add a blank line after the module docstring (#8283)
  • Parenthesize long type hints in assignments (#9210)
  • Preserve indent for single multiline-string call-expressions (#9673)
  • Normalize hex escape and unicode escape sequences (#9280)
  • Format module docstrings (#9725)

CLI

  • Explicitly disallow extend as part of a --config flag (#10135)
  • Remove build from the default exclusion list (#10093)
  • Deprecate ruff <path>, ruff --explain, ruff --clean, and ruff --generate-shell-completion in favor of ruff check <path>, ruff rule, ruff clean, and ruff generate-shell-completion (#10169)
  • Remove the deprecated CLI option --format from ruff rule and ruff linter (#10170)

Bug fixes

  • `flake8-bugbear`
  • `flake8-type-checking`
  • `pycodestyle`
  • `pydocstyle`
  • `pylint`
  • `ruff`
  • Fix ruff crashing on PowerPC systems because of too small page size (#10080)

Performance

  • Add cold attribute to less likely printer queue branches in the formatter (#10121)
  • Skip unnecessary string normalization in the formatter (#10116)

Documentation

  • Remove "Beta" Label from formatter documentation (#10144)
  • line-length option: fix link to pycodestyle.max-line-length (#10136)

0.3.1

Preview features

  • `pycodestyle`
  • `pycodestyle`
  • `pycodestyle`
  • `pylint`
  • `pylint`

Rule changes

  • `flake8-debugger`
  • `pyupgrade`
  • `pep8_naming`

CLI

  • Colorize the output of ruff format --diff (#10110)
  • Make --config and --isolated global flags (#10150)
  • Correctly expand tildes and environment variables in paths passed to --config (#10219)

Configuration

  • Accept a PEP 440 version specifier for required-version (#10216)
  • Implement isort's default-section setting (#10149)

Bug fixes

  • Remove trailing space from CapWords message (#10220)
  • Respect external codes in file-level exemptions (#10203)
  • `flake8-raise`
  • `pylint`
  • `ruff`

0.3.2

Preview features

  • Improve single-with item formatting for Python 3.8 or older (#10276)

Rule changes

  • `pyupgrade`
  • `pycodestyle`

Bug fixes

  • Fix trailing kwargs end of line comment after slash (#10297)
  • Fix unstable with items formatting (#10274)
  • Avoid repeating function calls in f-string conversions (#10265)
  • Fix E203 false positive for slices in format strings (#10280)
  • Fix incorrect Parameter range for *args and **kwargs (#10283)
  • Treat typing.Annotated subscripts as type definitions (#10285)

0.3.3

Preview features

  • `flake8-bandit`
  • `pycodestyle`
  • `pycodestyle`
  • `pylint`

Rule changes

  • `flake8_comprehensions`
  • `flake8-bandit`
  • `pyflakes`
  • `pylint`
  • `pylint`

CLI

  • Add message on success to ruff check (#8631)

Bug fixes

  • `PIE970`
  • Avoid TRIO115 if the argument is a variable (#10376)
  • `F811`
  • Fix F821 and F822 false positives in .pyi files (#10341)
  • Fix F821 false negatives in .py files when from __future__ import annotations is active (#10362)
  • Fix case where Indexer fails to identify continuation preceded by newline #10351 (#10354)
  • Sort hash maps in Settings display (#10370)
  • Track conditional deletions in the semantic model (#10415)
  • `C413`
  • `pycodestyle`
  • `pycodestyle`
  • `pylint`
  • Gate f-string struct size test for Rustc < 1.76 (#10371)

Documentation

  • Use ruff.toml format in README (#10393)
  • `RUF008`
  • `pylint`
  • Remove . from check and format commands (#10217)

0.3.4

Preview features

  • `flake8-simplify`
  • `pylint`
  • `pylint`
  • `pylint`
  • `refurb`

Rule changes

  • `flake8-pytest-style`
  • `pycodestyle`

Formatter

  • Fix unstable formatting for trailing subscript end-of-line comment (#10492)

Bug fixes

  • Avoid code comment detection in PEP 723 script tags (#10464)
  • Avoid incorrect tuple transformation in single-element case (C409) (#10491)
  • Bug fix: Prevent fully defined links name from being reformatted (#10442)
  • Consider raw source code for W605 (#10480)
  • Docs: Link inline settings when not part of options section (#10499)
  • Don't treat annotations as redefinitions in .pyi files (#10512)
  • Fix E231 bug: Inconsistent catch compared to pycodestyle, such as when dict nested in list (#10469)
  • Fix pylint upstream categories not showing in docs (#10441)
  • Add missing Options references to blank line docs (#10498)
  • 'Revert "F821: Fix false negatives in .py files when from __future__ import annotations is active (#10362)"' (#10513)
  • Apply NFKC normalization to unicode identifiers in the lexer (#10412)
  • Avoid failures due to non-deterministic binding ordering (#10478)
  • `flake8-bugbear`
  • `flake8-quotes`

0.3.5

Preview features

  • `pylint`
  • `refurb`
  • `refurb`
  • `refurb`

Rule changes

  • `flake8-comprehensions`
  • `flake8-pyi`
  • `numpy`
  • `pycodestyle`
  • `pycodestyle`

Configuration

  • Respected nested namespace packages (#10541)
  • `flake8-boolean-trap`

Bug fixes

  • Correctly handle references in __all__ definitions when renaming symbols in autofixes (#10527)
  • Track ranges of names inside __all__ definitions (#10525)
  • `flake8-bugbear`
  • `flake8-copyright`
  • `flake8-datetimez`
  • `flake8-pytest-style`
  • `flake8-quotes`
  • `isort`
  • `isort`
  • `pyflakes`
  • `pyflakes`
  • `pylint`
  • `ruff`

Documentation

  • Add PR title format to CONTRIBUTING.md (#10665)
  • Fix list markup to include blank lines required (#10591)
  • Put flake8-logging next to the other flake8 plugins in registry (#10587)
  • `flake8-bandit`
  • `flake8-bugbear`
  • `flake8-datetimez`
  • `pycodestyle`
  • `ruff`

0.3.6

Preview features

  • `pylint`
  • `pylint`
  • `pyupgrade`
  • `refurb`
  • `refurb`
  • `refurb`
  • `refurb`
  • `flake8_comprehensions`

Rule changes

  • `pydocstyle`
  • `pycodestyle`
  • `flake8-pyi`
  • `flake8-slots`
  • `pyflakes`
  • `pygrep-hooks`

CLI

  • Support FORCE_COLOR env var (#10839)

Configuration

  • Support negated patterns in [extend-]per-file-ignores (#10852)

Bug fixes

  • `flake8-import-conventions`
  • `flake8-quotes`
  • `pep8-naming`
  • `flake8-quotes`
  • `flake8-simplify`
  • `ruff`
  • `flake8-pytest-style`
  • `flake8-return`
  • `refurb`
  • `pylint`
  • `pydocstyle`
  • Respect # noqa directives on __all__ openers (#10798)

0.3.7

Preview features

  • `flake8-bugbear`
  • `pylint`

Bug fixes

  • Avoid TOCTOU errors in cache initialization (#10884)
  • `pylint`
  • `pylint`