Ruff v0.16.0 release notes / what's new

Ruff v0.16.0 release notes / what's new

Ruff v0.16.0 expands default linting to 413 rules

Ruff v0.16.0 drastically increases the number of enabled default rules from 59 to 413. This change allows users to catch severe issues, including syntax errors and immediate runtime errors, without requiring manual configuration.

Impact of the expanded rule set

The new default set incorporates rules from popular linters such as flake8-bugbear (B) and pyupgrade (UP), as well as Ruff's own RUF category. This shift moves Ruff toward a "zero-config" experience where most projects receive high-quality linting out of the box.

Users who prefer the previous default behavior can revert to the v0.1.0 rule set using the following configuration:

[lint]
select = ["E4", "E7", "E9", "F"]

Community Perspective on Default Rules

While many users welcome the reduced configuration overhead, some express concerns regarding the stability of CI pipelines when updating the tool.

"If you listen closely you can hear the thousands of CI jobs that just pull latest UV failing all at once."

Other developers have suggested a "state version" mechanism similar to Nix to allow teams to opt-in to new default rule sets at their own pace rather than facing immediate violations upon updating.

New Formatting and Suppression Features

Markdown code block formatting

Ruff v0.16.0 can now format Python code embedded within Markdown files. It targets fenced code blocks with info strings such as python, py, python3, py3, pyi, or pycon.

  • pyi blocks: Formatted as stub files.
  • pycon blocks: Formatted as REPL sessions.
  • Quarto support: Ruff recognizes language identifiers within curly braces (e.g., ````{python}`).

Formatting can be suppressed using fmt: off and fmt: on comments within the code block, or via HTML comments (e.g., <!-- fmt: off -->) to disable formatting for entire document regions. To disable Markdown formatting entirely, users can use the extend-exclude setting with a glob like *.md.

Enhanced ruff: ignore suppression

Ruff introduces a native suppression comment format that can be used on its own line, providing more flexibility than standard noqa comments.

  • ruff: ignore: Suppresses a diagnostic on the current line or the following logical line (e.g., a function header).
  • ruff: file-ignore: Suppresses specific diagnostics for the entire file.
  • Reasoning: Both comment types now support an associated "reason" string to explain why the suppression was added.

These comments can be added automatically via the --add-ignore CLI flag. In preview mode, these comments support using rule names (e.g., unused-import) instead of alphanumeric codes.

Improved Diagnostic Output and Fixes

Integrated diffs in check and format --check

Ruff now displays the diff for linter and formatter fixes directly within the default full output format. Previously, the --diff flag was required, which suppressed the accompanying explanatory diagnostics. Now, available fixes are rendered immediately below the help subdiagnostic.

JSON output breaking changes

To better reflect internal diagnostic representations, several fields in the JSON output may now be null instead of defaulting to empty strings or row 1, column 1. Affected fields include:

  • filename
  • location
  • end_location
  • fix.edits[].location
  • fix.edits[].end_location

Stabilized Rules and Behaviors

Stabilized Rules

Twelve rules have moved from preview to stable, including:

  • AIR303: Airflow 3 incompatible function signature
  • CPY001: Missing copyright notice
  • FURB164: Unnecessary from float
  • FURB192: Sorted min/max
  • ISC004: Implicit string concatenation in collection literal
  • LOG004: Log exception outside except handler
  • PLE0304: Invalid bool return type
  • PLR0917: Too many positional arguments
  • PLR1708: StopIteration return
  • RUF036: None not at end of union
  • RUF063: Access annotations from class dict
  • RUF068: Duplicate entry in __all__

Stabilized Behaviors

Several behaviors previously only in preview are now stable, such as improved false-positive resolution for S310 (suspicious urlopen usage) and expanded API checks for FA102 (future required type annotations) to include collections.abc.

Sources