ruff/changelogs/0.4.x.md

26 KiB
Raw Permalink Blame History

Changelog 0.4.x

0.4.0

A new, hand-written parser

Ruff's new parser is >2x faster, which translates to a 20-40% speedup for all linting and formatting invocations. There's a lot to say about this exciting change, so check out the blog post for more details!

See #10036 for implementation details.

A new language server in Rust

With this release, we also want to highlight our new language server. ruff server is a Rust-powered language server that comes built-in with Ruff. It can be used with any editor that supports the Language Server Protocol (LSP). It uses a multi-threaded, lock-free architecture inspired by rust-analyzer and it will open the door for a lot of exciting features. Its also faster than our previous Python-based language server -- but you probably guessed that already.

ruff server is only in alpha, but it has a lot of features that you can try out today:

  • Lints Python files automatically and shows quick-fixes when available
  • Formats Python files, with support for range formatting
  • Comes with commands for quickly performing actions: ruff.applyAutofix, ruff.applyFormat, and ruff.applyOrganizeImports
  • Supports source.fixAll and source.organizeImports source actions
  • Automatically reloads your project configuration when you change it

To setup ruff server with your editor, refer to the README.md.

Preview features

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

Rule changes

  • `flake8-bandit`
  • `flake8-bugbear`
  • `flake8-slots`
  • `pylint`

Linter

  • Improve handling of builtin symbols in linter rules (#10919)
  • Improve display of rules in --show-settings (#11003)
  • Improve inference capabilities of the BuiltinTypeChecker (#10976)
  • Resolve classes and functions relative to script name (#10965)
  • Improve performance of RuleTable::any_enabled (#10971)

Server

This section is devoted to updates for our new language server, written in Rust.

  • Enable ruff-specific source actions (#10916)
  • Refreshes diagnostics for open files when file configuration is changed (#10988)
  • Important errors are now shown as popups (#10951)
  • Introduce settings for directly configuring the linter and formatter (#10984)
  • Resolve configuration for each document individually (#10950)
  • Write a setup guide for Neovim (#10987)

Configuration

  • Add RUFF_OUTPUT_FILE environment variable support (#10992)

Bug fixes

  • Avoid non-augmented-assignment for reversed, non-commutative operators (PLR6104) (#10909)
  • Limit commutative non-augmented-assignments to primitive data types (PLR6104) (#10912)
  • Respect per-file-ignores for RUF100 on blanket # noqa (#10908)
  • Consider if expression for parenthesized with items parsing (#11010)
  • Consider binary expr for parenthesized with items parsing (#11012)
  • Reset FOR_TARGET context for all kinds of parentheses (#11009)

0.4.1

Preview features

  • `pylint`
  • `pylint`

Bug fixes

  • `pylint`
  • Parser: Use empty range when there's "gap" in token source (#11032)
  • `ruff`
  • Parser: Expect indented case block instead of match stmt (#11033)

0.4.2

Rule changes

  • `flake8-pyi`
  • `pyupgrade`
  • `refurb`

Server

  • Fix an issue with missing diagnostics for Neovim and Helix (#11092)
  • Implement hover documentation for noqa codes (#11096)
  • Introduce common Ruff configuration options with new server settings (#11062)

Bug fixes

  • Use macos-12 for building release wheels to enable macOS 11 compatibility (#11146)
  • `flake8-blind-expect`
  • `flake8-pyi`
  • `flake8-simplify`
  • `refurb`
  • `ruff`
  • `ruff`

Documentation

  • `flake8-bugbear`
  • `flake8-type-checking`
  • `isort`
  • `pylint`

Performance

  • Use matchit to resolve per-file settings (#11111)

0.4.3

Enhancements

  • Add support for PEP 696 syntax (#11120)

Preview features

  • `refurb`
  • `refurb`
  • `refurb`
  • `ruff`
  • `pyflakes`

Rule changes

  • `flake8-bugbear`
  • `flake8-logging`
  • `pylint`
  • `ruff`

Formatter

  • Avoid multiline expression if format specifier is present (#11123)

LSP

  • Write ruff server setup guide for Helix (#11183)
  • ruff server no longer hangs after shutdown (#11222)
  • ruff server reads from a configuration TOML file in the user configuration directory if no local configuration exists (#11225)
  • ruff server respects per-file-ignores configuration (#11224)
  • ruff server: Support a custom TOML configuration file (#11140)
  • ruff server: Support setting to prioritize project configuration over editor configuration (#11086)

Bug fixes

  • Avoid debug assertion around NFKC renames (#11249)
  • `pyflakes`
  • `ruff`
  • `pygrep_hooks`
  • `perflint`
  • `pyflakes`

Performance

  • Avoid allocations for isort module names (#11251)
  • Build a separate ARM wheel for macOS (#11149)

Windows

  • Increase the minimum requirement to Windows 10.

0.4.4

Preview features

  • `pycodestyle`
  • `pylint`
  • `flake8-pyi`
  • `flake8-pyi`

Rule changes

  • `flake8-boolean-trap`
  • `flake8-bugbear`

Server

  • Expand tildes when resolving Ruff server configuration file (#11283)
  • Fix ruff server hanging after Neovim closes (#11291)
  • Editor settings are used by default if no file-based configuration exists (#11266)

Bug fixes

  • `pylint`
  • `flake8-blind-except`, `tryceratops`
  • Recognise assignments such as __all__ = builtins.list(["foo", "bar"]) as valid __all__ definitions (#11335)

0.4.5

Ruff's language server is now in Beta

v0.4.5 marks the official Beta release of ruff server, an integrated language server built into Ruff. ruff server supports the same feature set as ruff-lsp, powering linting, formatting, and code fixes in Ruff's editor integrations -- but with superior performance and no installation required. We'd love your feedback!

You can enable ruff server in the VS Code extension today.

To read more about this exciting milestone, check out our blog post!

Rule changes

  • `flake8-future-annotations`
  • `isort`
  • `pycodestyle`
  • `pyflakes`
  • `pyflakes`
  • `pyupgrade`

Formatter

  • Avoid multiline quotes warning with quote-style = preserve (#11490)

Server

  • Support Jupyter Notebook files (#11206)
  • Support noqa comment code actions (#11276)
  • Fix automatic configuration reloading (#11492)
  • Fix several issues with configuration in Neovim and Helix (#11497)

CLI

  • Add --output-format as a CLI option for ruff config (#11438)

Bug fixes

  • Avoid PLE0237 for property with setter (#11377)
  • Avoid TCH005 for if stmt with elif/else block (#11376)
  • Avoid flagging __future__ annotations as required for non-evaluated type annotations (#11414)
  • Check for ruff executable in 'bin' directory as installed by 'pip install --target'. (#11450)
  • Sort edits prior to deduplicating in quotation fix (#11452)
  • Treat escaped newline as valid sequence (#11465)
  • `flake8-pie`
  • `pylint`
  • `pylint`
  • `refurb`

Documentation

  • Add --preview to the README (#11395)
  • Add Python 3.13 to list of allowed Python versions (#11411)
  • Simplify Neovim setup documentation (#11489)
  • Update CONTRIBUTING.md to reflect the new parser (#11434)
  • Update server documentation with new migration guide (#11499)
  • `pycodestyle`
  • `pyflakes`
  • `pylint`

0.4.6

Breaking changes

  • Use project-relative paths when calculating GitLab fingerprints (#11532)
  • Bump minimum supported Windows version to Windows 10 (#11613)

Preview features

  • `flake8-async`

Rule changes

  • `numpy`
  • `mccabe`
  • Consider match-case statements for C901, PLR0912, and PLR0915 (#11521)
  • Remove empty strings when converting to f-string (UP032) (#11524)
  • `flake8-bandit`
  • `flake8-self`
  • `pyupgrade`

Server

  • Respect excludes in ruff server configuration discovery (#11551)
  • Use default settings if initialization options is empty or not provided (#11566)
  • ruff server correctly treats .pyi files as stub files (#11535)
  • ruff server searches for configuration in parent directories (#11537)
  • ruff server: An empty code action filter no longer returns notebook source actions (#11526)

Bug fixes

  • `flake8-logging-format`
  • `refurb`
  • `flake8-simplify`
  • Create intermediary directories for --output-file (#11550)
  • Propagate reads on global variables (#11584)
  • Treat all singledispatch arguments as runtime-required (#11523)

0.4.7

Preview features

  • `flake8-pyi`
  • `flake8-pyi`
  • `flake8-pyi`
  • `pyflakes`

Formatter

  • Fix incorrect placement of trailing stub function comments (#11632)

Server

  • Respect file exclusions in ruff server (#11590)
  • Add support for documents not exist on disk (#11588)
  • Add Vim and Kate setup guide for ruff server (#11615)

Bug fixes

  • Avoid removing newlines between docstring headers and rST blocks (#11609)
  • Infer indentation with imports when logical indent is absent (#11608)
  • Use char index rather than position for indent slice (#11645)
  • `flake8-comprehension`
  • Mark repeated-isinstance-calls as unsafe on Python 3.10 and later (#11622)

0.4.8

Performance

  • Linter performance has been improved by around 10% on some microbenchmarks by refactoring the lexer and parser to maintain synchronicity between them (#11457)

Preview features

  • `flake8-bugbear`
  • `flake8-pyi`
  • `pygrep_hooks`

Rule changes

  • `pyupgrade`
  • `numpy`

Server

  • Formatting a document with syntax problems no longer spams a visible error popup (#11745)

CLI

  • Add RDJson support for --output-format flag (#11682)

Bug fixes

  • `pyupgrade`
  • `flake8-simplify`
  • Ensure the expression generator adds a newline before type statements (#11720)
  • Respect per-file ignores for blanket and redirected noqa rules (#11728)

0.4.9

Preview features

  • `pylint`
  • `refurb`

Rule changes

  • `pycodestyle`

Formatter

  • Fix formatter instability for lines only consisting of zero-width characters (#11748)

Server

  • Add supported commands in server capabilities (#11850)
  • Use real file path when available in ruff server (#11800)
  • Improve error message when a command is run on an unavailable document (#11823)
  • Introduce the ruff.printDebugInformation command (#11831)
  • Tracing system now respects log level and trace level, with options to log to a file (#11747)

CLI

  • Handle non-printable characters in diff view (#11687)

Bug fixes

  • `refurb`
  • `flake8-bugbear`
  • `refurb`

0.4.10

Parser

  • Implement re-lexing logic for better error recovery (#11845)

Rule changes

  • `flake8-copyright`
  • `pycodestyle`

Server

  • Add tracing setup guide to Helix documentation (#11883)
  • Add tracing setup guide to Neovim documentation (#11884)
  • Defer notebook cell deletion to avoid an error message (#11864)

Security

  • Guard against malicious ecosystem comment artifacts (#11879)