AI觉醒星球
Awakening is here
Knowledge File / AI技能杠杆
2026-07-26 0 浏览 会员

Ruff v0.16.0

Ruff 发布了 v0.16.0 版本,默认启用规则从 59 条增加到 413 条,许多严重问题现在无需配置即可被检测到。

SOURCE / AI技能杠杆 MIN / 4 ACCESS / 会员 POST / 2026-07-26 06:44:05

原贴

查看原文
作者:Simon Willison 来源站点:simonwillison.net 原贴时间:

原文

Ruff v0.16.0 Astral shipped a significant new version of their Ruff Python linting tool a few days ago on July 23rd. I noticed today because my various CI jobs all started failing thanks to new default Ruff checks and my unpinned "ruff" dev dependency. From Brent Westbrook's announcement post: Ruff now enables 413 rules by default, up from 59 in previous versions. Since Ruff's default rule set was last modified in v0.1.0 , the number of rules in Ruff has grown from 708 to 968. Many of these rules catch severe issues, including syntax errors and immediate runtime errors but were not previously enabled by default. With the new rule set, Ruff will bring these issues and many others to your attention without any Ruff configuration. Here's a one-liner for trying it on any Python project: uvx ruff@latest check . I ran the latest Ruff against my three biggest projects - Datasette , sqlite-utils , and LLM - and it found hundreds of minor issues that breached the new default rules. All three projects have very comprehensive test suites, executed in CI against Python 3.10 through Python 3.14, so upgrades like this are pretty safe. The following command did the bulk of the upgrades: uvx ruff@latest check . --fix --unsafe-fixes Against sqlite-utils , that command reported: Found 1618 errors (1538 fixed, 80 remaining). As an illustrative example, here are three of the remaining issues. Ruff does a nice job of explaining each one: DTZ005 `datetime.datetime.now()` called without a `tz` argument --> tests/test_duplicate.py:17:10 | 15 | "datetime_col" TEXT)""") 16 | # Insert one row of mock data: 17 | dt = datetime.datetime.now() | ^^^^^^^^^^^^^^^^^^^^^^^ 18 | data = { 19 | "text_col": "Cleo", | help: Pass a `datetime.timezone` object to the `tz` parameter BLE001 Do not catch blind exception: `Exception` --> tests/test_plugins.py:16:12 | 14 | db.execute("select * from pragma_function_list()") 15 | return True 16 | except Exception: | ^^^^^^^^^ 17 | return False 18 | finally: | B018 Found useless attribute access. Either assign it to a variable or remove it. --> tests/test_update.py:46:5 | 44 | def test_update_invalid_pk(fresh_db, pk, update_pk): 45 | table = fresh_db["table"] 46 | table.insert({"id1": 5, "id2": 3, "v": 1}, pk=pk).last_pk | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 47 | with pytest.raises(NotFoundError): 48 | table.update(update_pk, {"v": 2}) | Unsurprisingly, given Astral's new home at OpenAI , this output provides everything a coding agent would need to fix the problems. I had Codex (GPT-5.6 Sol high) upgrade LLM and sqlite-utils , and Claude Code (with Opus 5) upgrade Datasette . Tags: python , ruff , astral

中文翻译

Ruff v0.16.0 Astral 于 7 月 23 日发布了其 Python 代码检查工具 Ruff 的一个重要新版本。我今天注意到,因为我的各种 CI 作业由于新的默认 Ruff 检查和我未固定版本的 "ruff" 开发依赖而开始失败。来自 Brent Westbrook 的公告:Ruff 现在默认启用 413 条规则,而之前版本是 59 条。由于 Ruff 的默认规则集上次修改是在 v0.1.0,Ruff 中的规则总数从 708 条增长到 968 条。许多这些规则捕获严重问题,包括语法错误和即时运行时错误,但之前并未默认启用。使用新的规则集,Ruff 将在无需任何配置的情况下让您注意到这些问题以及其他许多问题。以下是在任何 Python 项目上尝试的一行命令:uvx ruff@latest check .

核心信息

Ruff 发布了 v0.16.0 版本,默认启用规则从 59 条增加到 413 条,许多严重问题现在无需配置即可被检测到。

  • Ruff 发布了 v0.16.0 版本,默认启用规则从 59 条增加到 413 条,许多严重问题现在无需配置即可被检测到。
  • 原贴提到:Ruff v0.16.0 Astral shipped a significant new version of their Ruff Pyth
  • 来源:simonwillison.net
试看内容

成为会员查看完整内容

你已经看到了这篇内容的前置整理,剩余深度部分仅对会员开放。

详细解读 信息差价值 参考来源
成为会员查看完整内容
上一篇 Codex 并行 QA 发现复杂行为问题 下一篇 我们将@covacut和@davis7聚集在一起,实时用Codex和他们的Codex Micro键盘构建一个项目