全部文章0

Hacker Newsvismit2000··访问 1

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

原网页

Article URL: https://astral.sh/blog/ruff-v0.16.0

Comments URL: https://news.ycombinator.com/item?id=49056112

Points: 323

# Comments: 200

Hacker News 讨论

323 points · 203 comments · 查看原帖

  1. nickjj

    I updated a ~3k line Python project with this the other day. I was using v0.15.x beforehand. It didn't take too long and the new rules do improve code quality. It caught quite a few things previous versions didn't. Here's a few commits of changes: (A whole bunch of manual changes based on its suggestions) https://github.com/nickjj/plutus/commit/9af66d31f98bef841588... (Re-enable line length) https://github.com/nickjj/plutus/commit/21789f89bbcee37913c1... (Force _ prefix for unused variables) https://github.com/nickjj/plutus/commit/a272c77b932e1c78558a... (Auto-corrected by Ruff) https://github.com/nickjj/plutus/commit/6fe69cf88385ebdf9b8c...

  2. woadwarrior01

    Great to see ruff, ty and uv being actively developed, even after Astral was acquired by OpenAI.

  3. maratc

    The amount of fascination that people have with these "grammar nazi" bots -- some of them implementing completely arbitrary "rules" and some of them disagreeing with others on what "good" Python code should look like -- doesn't stop to amaze me. Here's "bad" code: important_numbers = { 'x': 3, 'y': 42, # Answer to the Ultimate Question! 'z': 2 } Here's what "good" code should look like: important_numbers = {"x": 3, "y": 42, "z": 2} # Answer to the Ultimate Question! Which completely misses the writer's intent. But did you notice that there are two spaces before the pound now? Also, the quotes are now double because apparently it's somehow more kosher! So much improvement! The actual problems in the code I work with are not the spaces at the end of line or imports in non-alphabetic order, it's the 10-line list comprehensions that are so long that they're impossible for me to parse. None o

  4. gempir

    I wish Go had something like Ruff! A lot of languages are getting amazing tool but Go has a very fragmented ecosystem with a lot of tools but none of them feel as high quality has the likes of Ruff, Oxc, Biome or even PHP's Mago

  5. hyeongjun

    Good news. enabling 413 rules by default means most projects get useful linting without touching the config at all!

  6. jon-wood

    I really wish Ruff would introduce something similar to Nix’s stateVersion, which is used to determine the set of defaults that will be applied. Updating Ruff at a scale beyond a single repo is a bit of a crapshoot currently, with every version introducing a bunch of new default rules which you then have to deal with immediately (either by turning them off or fixing them). I’m aware we could have an allowlist in place which specifies all rules that are turned on but I’d much rather have a simpler config file, and be able to bump the state version at a good time for everyone to spend a few hours fixing new violations.

  7. aomix

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

  8. kstenerud

    This is great news! With the advent of agentic coding, strong linting is more important than ever. What I'd really like to see is forbidigo for more languages.