Live data from Hacker News

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

astral.sh

221–230 of 247 posts

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

#221

Earlier quoted context omitted.

FWIW, ruff sees your line comment and keeps each item on its line. It only adds a trailing comma and additional space. It also does not collapse lines when there’s a trailing comma. Your output seems to be from black. IMO it’s insane to collapse lines when there are line comments. $ uvx ruff format --diff formatting.py --- formatting.py +++ formatting.py @@ -1,8 +1,4 @@ -no_comma = { - "x": 3, - "y": 42, - "z": 2 -}…

(am not the GP) I personally like double quotes, because in so many other languages they are for strings, while single quotes are often for other things. But somehow many people have a single quotes obsession in Python. I am guessing, that it is because of ease of typing them on a US keyboard layout.

> many people have a single quotes obsession

Not my problem. My problem is that I want to use them both, as I've been able to for many years.

I'll always use double to surround "can't" and single to surround '8.5" x 14"'. I'll use a context-appropriate pair when adding to existing code. But for all the other cases, I don't want to expend any energy on this. It's a complete non-issue.

> ease of typing them on a US keyboard layout

On both the US and European keyboards single-quotes are easier: no need to press Shift.

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

#222
post #211
post #41

Earlier quoted context omitted.

People tend to use tools set up in CICD and/or precommit. Without rules everyone uses their tool and is unwilling to compromise. Even if they are willing it is hard to setup tools to do exactly what you want. Default configuration is always the way.

So to the practical question: what we're gonna do today in CICD and/or precommit? "Default configuration is always the way" but which one: `ruff<0.16.0` or `ruff=0.16.0`?

I would stick to older ruff until team has resources to fix issues and move to newer version. The same think you do with other dependencies.

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

#223
post #36

Earlier quoted context omitted.

It does and it is even better. It is called the Go Analysis Framework ( https://pkg.go.dev/golang.org/x/tools/go/analysis ). It is fairly new so not well known but it is what powers go fix and go vet under the hood. And I believe the Go team is currently working on making it possible for module authors to easily describe their own custom analysis passes that would run automatically when running go fix. It is extremel…

That sounds amazing! I do hope golangci-lint and the likes pick it up, I'm a big fan of the strict by default approach that Ruff and other linters have taken. Gofmt is great but it's still not very strict, the amount of times my colleagues have argued about formatting in Go is still too great, stuff like consts, types, funcs, methods order, struct initialziation newlines and other details that do matter, but they sho…

golangci-lint is already using this framework for like 90% checks

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

#224
post #222
post #211

Earlier quoted context omitted.

So to the practical question: what we're gonna do today in CICD and/or precommit? "Default configuration is always the way" but which one: `ruff<0.16.0` or `ruff=0.16.0`?

I would stick to older ruff until team has resources to fix issues and move to newer version. The same think you do with other dependencies.

I find it hard to look at ruff as at "other dependencies."

First, my other dependencies usually deliver something of value to the customer (and so I deliver my other dependencies to the end-user installation.) Second, when I need to change code to accommodate other dependencies, it is usually limited to a couple of files, sometimes to a couple of modules; this change will touch much, much more than that. Third, my other dependencies at least play nice by implementing semver and bumping a major release on a breaking change.

Nothing of that applies to this change.

> fix issues

Which weren't "issues" at all just this morning.

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

#225
post #209

Earlier quoted context omitted.

Wowsers. As what I think is a fellow traveler, I would encourage you to look back at all the places you created art and ask how many friends you made at each stop.

Please don't turn this site into Reddit.

Not quite sure I follow but please do edify me.

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

#226
post #183
post #47

Earlier quoted context omitted.

go vet, plus all the ones in gopls?

I don't believe you can add custom analyzers to `go vet`, which arguably rules it out. But it is extremely simple to make a custom vet-like tool, because it's a trivial binary wrapper around the analysis framework, which is first-party (though it's structurally pretty limited by design, and won't handle all linting needs): https://cs.opensource.google/go/go/+/refs/tags/go1.26.5:src/...

-vettool allows using different analyzers built with the analysis framework: https://pkg.go.dev/cmd/go#:~:text=The%20%2Dvettool%3Dprog%20...

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

#227
post #221

Earlier quoted context omitted.

(am not the GP) I personally like double quotes, because in so many other languages they are for strings, while single quotes are often for other things. But somehow many people have a single quotes obsession in Python. I am guessing, that it is because of ease of typing them on a US keyboard layout.

> many people have a single quotes obsession Not my problem. My problem is that I want to use them both , as I've been able to for many years. I'll always use double to surround "can't" and single to surround '8.5" x 14"'. I'll use a context-appropriate pair when adding to existing code. But for all the other cases, I don't want to expend any energy on this. It's a complete non-issue. > ease of typing them on a US ke…

Regional keyboards are a mess for coding. I'm much happier with a qmk-enabled keyboard where I remap keys in hardware. For instance, on a French keyboard:

- easy: " ' , : * ! - _ = ( )

- harder (shift): numbers . µ ? / ℅ +

- hardest (Alt Gr): []{}€~|`^\@#

This is not exhaustive, but some of the most common symbols are quite hard to type: not surprising as most language designers use US keyboards. Still, I think everyone would benefit from a "symbols" layer on their keyboards.

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

#228
post #73

Earlier quoted context omitted.

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.

In my own experience it works pretty well. In fact better than the autoformatters.

It was essentially not an issue. Sometimes I’d grumble about someone, but it would never get in my way the way black or ruff would regularly.

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

#229
post #35

Earlier quoted context omitted.

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!

You can still talk to them about more important problems than placement of collons and closing bracket.

Actually the aesthetic preferences of people I regularly work with are important to me.

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

#230
post #224
post #222

Earlier quoted context omitted.

I would stick to older ruff until team has resources to fix issues and move to newer version. The same think you do with other dependencies.

I find it hard to look at ruff as at "other dependencies." First, my other dependencies usually deliver something of value to the customer (and so I deliver my other dependencies to the end-user installation.) Second, when I need to change code to accommodate other dependencies, it is usually limited to a couple of files, sometimes to a couple of modules; this change will touch much, much more than that. Third, my ot…

I also do not like if project stays on 0 version to break compatibility with every minor version. This is the problem with many rust tools and libraries. I think it is unfair to do that years after first release and with healthy community. But it is a tradeoff and not using ruff is in my opinion worse.

To your other issues, just do not upgrade. There is no need to upgrade everything a few days after release. I always lock ruff to version I like and upgrade whenever it is convenient.

Post reply on HN