logo
Kurashizu Blogwhere ideas flow
  • Home
  • News
  • Blog
  • About
  • Home
  • News
  • Blog
  • About

© 2026 Kurashizu. All rights reserved.

Admin·New Post·Service Status
Powered by Cloudflare·06.11.26
← Back to news

Ruff v0.16.0 – Significant new updates – 413 default rules up from 59

Original article
astral.sh|293 points|178 comments|by vismit2000|Jul 26, 2026

Ruff v0.16.0: Major Update — Default Rules Jump from 59 to 413

Published: July 23, 2026 | Author: Brent Westbrook (@ntBre)

Ruff v0.16.0 has officially arrived! You can grab the latest version via PyPI or utilize your preferred package manager:

uv tool install ruff@latest

Quick Reminder: Ruff is a high-performance Python linter and formatter crafted in Rust. It is designed to be a drop-in replacement for Black, Flake8 (and its various plugins), isort, pydocstyle, and pyupgrade, often running orders of magnitude faster than these tools combined.

🛠️ Migrating to v0.16

Updating to this version is straightforward. While there are a few breaking changes, they are minimal, meaning most developers can upgrade without needing to overhaul their existing configurations or source code.

  • Update Ruff to v0.16.0
  • Review new default rule warnings
  • Test Markdown formatting in documentation

📈 An Enhanced Default Rule Set

One of the most significant shifts in v0.16 is the expansion of the default rule set. Ruff now enables 413 rules by default, a massive increase from the previous 59.

Rule Growth Comparison

The total library of available rules has expanded significantly since v0.1.0:

VersionDefault Rules EnabledTotal Rules Available
v0.1.059708
v0.16.0413968

The growth in total rules can be expressed as: Growth=968−708708≈32.5%\text{Growth} = \frac{968 - 708}{708} \approx 32.5\%Growth=708968−708​≈32.5%

Many of these newly enabled rules target critical issues, such as immediate runtime errors and syntax mistakes, which previously required manual activation. Even if you utilize select or extend-select in your config, these defaults may introduce you to highly useful rules you hadn't yet discovered.

Key Highlights:

  • B: Rules from flake8-bugbear.
  • UP: Rules from pyupgrade.
  • RUF: Ruff's own internal rule category.

If the new defaults are too noisy for your project, you can revert to the legacy set using this configuration:

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

Note: This update is a stepping stone toward our broader goal of rule recategorization.

✨ New Features in v0.16

📝 Markdown Code Block Formatting

Ruff can now format Python snippets embedded within Markdown files. It targets fenced blocks using the following info strings: python, py, python3, py3, pyi, or pycon.

  • pyi blocks →\rightarrow→ Formatted as stub files.
  • pycon blocks →\rightarrow→ Formatted as REPL sessions.
  • Others →\rightarrow→ Standard Python formatting.

Example: In a README.md file:

import ruff
ruff_binary = (
    ruff.find_ruff_bin()
)

Running ruff format will now clean up the above block. This also extends to Quarto notebooks (e.g., .qmd files), provided your extension mapping is correctly configured.

How to suppress formatting:

  1. Inline: Use # fmt: off and # fmt: on inside the block.
  2. Regional: Use HTML comments: <!-- fmt: off -->
    x = "This won't be touched"
    
    <!-- fmt: on -->
  3. Global: Add *.md to your extend-exclude setting.

🚫 Advanced Suppression with ruff: ignore

Ruff introduces a new, dedicated suppression comment format. While v0.15 introduced range suppression via ruff: disable and ruff: enable, v0.16 adds more granularity.

  • ruff: ignore: Suppresses a diagnostic on the current line (like noqa) or the following logical line (e.g., a function header spanning multiple lines).
  • ruff: file-ignore: Disables specific diagnostics for the entire file.

Example with reasons:

# ruff: file-ignore[F401] Allow unused imports for API stability
import foo
import bar

# ruff: ignore[N803]
def legacy_Function_Name():
    pass

Pro Tip: Use the --add-ignore CLI flag to insert these automatically. In --preview mode, you can use rule names instead of codes:

❯ uvx ruff@latest check --preview --add-ignore try.py
# Result: import math # ruff: ignore[unused-import]

🔍 Fixes Integrated into Output

The check and format --check commands now display the actual diff of proposed fixes directly within the diagnostic output, appearing immediately below the help text.

Previously, you had to use the --diff flag, which often hid the explanatory diagnostics. Now, you get both.

Example Workflow: If you have:

if True: pass
elif False: pass

Running format --check will now show the exact transformation required. Furthermore, format --check now supports all the output formats available to the linter, including:

  • JSON (for machine reading)
  • GitHub / GitLab (for CI annotations)

Ruff Output Example

One final note on output formats...