HN
Today

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

Ruff, the blazing-fast Rust-powered Python linter and formatter, has unveiled v0.16.0 with substantial enhancements. This update significantly expands its default rule set from 59 to 413, introduces Markdown code block formatting, and refines suppression comments. The release is a hit on Hacker News, celebrated for improving out-of-the-box linting efficacy and advancing a critical tool in the Python developer's arsenal.

50
Score
6
Comments
#1
Highest Rank
10h
on Front Page
First Seen
Jul 26, 10:00 AM
Last Seen
Jul 26, 7:00 PM
Rank Over Time
1112136568

The Lowdown

Ruff v0.16.0 marks another significant stride for the popular Python linter and formatter, renowned for its speed, being written in Rust. This release brings a host of new features and stabilizations aimed at making Python development more robust and efficient.

  • Expanded Default Rules: The most notable change is the increase in default enabled rules from 59 to 413. This broadens Ruff's out-of-the-box capabilities, catching a wider array of syntax and runtime errors, and incorporating rules from popular linters like flake8-bugbear and pyupgrade.
  • Markdown Code Block Formatting: Ruff now supports formatting Python code embedded within Markdown files, including fenced code blocks with various info strings (python, pycon, pyi) and Quarto notebooks. This feature includes granular suppression controls using HTML comments or fmt comments within blocks.
  • Enhanced Suppression Comments: The introduction of ruff: ignore and ruff: file-ignore comments provides more flexible ways to suppress diagnostics, either for a single line, a logical block, or an entire file. These comments can also include reasons for suppression and, in preview, support rule names instead of just codes.
  • Visible Fixes in Output: Both check and format --check commands now display diffs for linter and formatter fixes directly within their output, improving visibility of proposed changes without needing a separate --diff flag.
  • Rule Stabilizations: Several rules and behaviors, previously in preview mode, have been stabilized, enhancing Ruff's reliability and feature set for general use.

These updates reinforce Ruff's position as a comprehensive and highly performant tool, further streamlining Python code quality workflows for developers.

The Gossip

Default Rule Deluge

Commenters largely applaud the decision to enable 413 rules by default, viewing it as a substantial improvement for out-of-the-box utility and reduced configuration burden. One user quickly tested the new defaults, noting its immediate flagging of unsorted imports and `except Exception` clauses. However, there's an underlying concern about the balance between strict linting and developer flexibility, especially when considering how AI code generation might interact with overly zealous rules.

Versioning Quandaries and Acquisition Questions

A recurring sentiment is frustration over Ruff's continued pre-1.0 versioning, despite its perceived maturity and dominance in the Python ecosystem. One commenter laments the 'small number of breaking changes' in a pre-1.0 release, expressing mild exasperation, possibly exacerbated by the recent acquisition of Astral (Ruff's parent company) by OpenAI, hinting at a loss of trust or increased scrutiny on the project's direction.

AI's Linting Liaisons

An intriguing discussion emerges around the intersection of strong linting tools like Ruff and the rise of 'agentic coding' (AI-generated code). Commenters ponder the increased importance of robust linting in this context. There's skepticism about AI's 'judgment' on code quality, with concerns that AI might generate hacks to satisfy linters or even disable tests to bypass issues, rather than truly understanding and adhering to best practices.