Live data from Hacker News

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

astral.sh

71–80 of 247 posts

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

#72
post #58

Earlier quoted context omitted.

Maybe it's just me, but getting overrun with "413 x potential warnings" hardly sounds useful :) Great for greenfield, less so for existing projects. Although nowadays, fire up your agent with "/goal work through and address all lint warnings by fixing the code according to XYZ" and leave it alone for a couple of hours and I guess it's no longer an issue... Don't get me wrong, the new level of details coming from Ruff…

> uv run ruff check --fix Generally gets you 90% there.

On the 0.16.0 release it was more like 10% autofixable on the codebases I maintain. One of them had 100+ unfixable errors across less than 10k lines of code and tests in total. Previous ruff version labeled it perfectly clean on format and check with default settings.

Good thing we have LLM:s that can do the tedious work of checking each case and applying local annotations or updating the config globally! If I was stuck doing this manually, I would have just gotten rid of ruff and went back to black+pylint.

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

#73
post #13

Earlier quoted context omitted.

Those tools actually save team energy. Without them any programmer has different opinion on formating, code quality, what is readable etc. You can discuss it endlesly or you can just use ruff.

Gods forbid I talk to people I work with, learn their preferences, and figure out the way we can accommodate each other. Sounds like such a waste of energy. It’s so much better if we all acquiesce to the preferences of some people neither of works with!

How does that work when hundreds of people are working on a project, with a few new people joining every week?

It boggles me that anyone would argue against standardization, or believe that “just get hundreds of people to agree today and tomorrow and every future day” is a better solution.

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

#74
post #64

Earlier quoted context omitted.

It’s because you forgot a comma after the last item. If you had kept that the items wouldn’t have been compacted (at least in black, I’ve stopped linking my code because it breaks intends of formatting more often than it helps)

Sorry, but I did not "forg[e]t a comma after the last item". I intentionally did not put a comma there. The list of the "important numbers" in my example is already complete and perfect, and is not supposed to ever change. I wanted to emphasise this fact by specifically omitting the comma there, in the hope that intelligent people in the future would get this message exactly as I intended for it to be.

Must be nice to write code with the hopes that only intelligent people will read it.

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

#75
post #71
post #69

Earlier quoted context omitted.

In reality it got me 30% there.

That suggests it’s doing its job.

I don't think they were trying to say "No, ruff doesn't work at all", more that "gets you 90% there" might have been an over-exaggeration, or very codebase-specific number and really, YMMV.

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

#76
post #66
post #52

Earlier quoted context omitted.

The actual rules are less important, only the consistency of applying them is. I find that people who argue against automatic linting and formatting tend to be the same that would argue incessantly about style. So much wasted energy, I want none of that. Also, in your example above, if you put the comment on the line _above_ instead of inline the formatter will most likely do the right thing.

"A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines." -- Ralph Waldo Emerson

TIL I am divine!

By the way, you have the exact energy of someone who would argue about code style: a prima donna who quotes Emerson when confronted with disagreement.

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

#77
post #20

Earlier quoted context omitted.

The point of the "grammar nazi" bots is to focus on the actual problems: if a bot is deciding about linting, you don't have to waste brain power to discuss it in PRs. It is what it is, everyone gets the same, shut up and work on what matters. I'm surprised you consider it a lot of energy spent, I tend not to spend any on this, it just runs automatically on my code and I drop out of pretty much every discussions about…

In my previous place, discussions on coding style were forbidden in PRs. It worked just fine. Edit: one could also use single or double quotes in strings, and it didn't anger the grammar nazi bots as there were none.

Using a consistent string delimiter has value: if you search for ['foo'] you will find all instances of the string foo. With inconsistent delimiters, you better have a single canonical 'foo' in your project or you're going to run into problems.

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

#79
post #64

Earlier quoted context omitted.

It’s because you forgot a comma after the last item. If you had kept that the items wouldn’t have been compacted (at least in black, I’ve stopped linking my code because it breaks intends of formatting more often than it helps)

Sorry, but I did not "forg[e]t a comma after the last item". I intentionally did not put a comma there. The list of the "important numbers" in my example is already complete and perfect, and is not supposed to ever change. I wanted to emphasise this fact by specifically omitting the comma there, in the hope that intelligent people in the future would get this message exactly as I intended for it to be.

The trailing comma rule is to avoid errors when devs copy/paste a line or dump a new line at the end. This matters particularly for arrays in languages with implicit string concatenation, where the missing comma won't trigger a compile error.

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

#80
post #53

Earlier quoted context omitted.

Waiting patiently for the other person to produce a post hoc rationalization about why everybody’s code looking different is in fact a good thing

Can you not read code if it uses single vs double quotes?

I can - in fact, I have to, a lot more than I'd like - when someone makes changes with different code style settings in their IDE or tooling, and that affects unrelated parts of the code, and suddenly the PR contains tons of code that just looks subtly different but still does the same thing.

If sieving the spam from ham in code reviews is your thing, go have fun.

I personally prefer code that is automatically and unconditionally kept in the exact same shape, preserving only the intended changes to stop the team from wasting time on formatting or reviewing.

Post reply on HN