Is there a way to change the blank line rule in Ruff?

0
1
Asked By CuriousCoder37 On

I'm curious if anyone else feels annoyed by the rule that mandates 2 blank lines between top-level functions in Ruff. It seems like such an excessive amount of vertical space, especially with modern monitors being wider than taller. Unlike most programming languages, which don't typically have this convention, I find it distracting. Since I'm using Ruff for code formatting, I'm wondering if there's a way to set it to only have 1 blank line between top-level functions and classes. I've also raised this issue on the Ruff GitHub page but thought I'd check here as well to see if this option exists already or needs to be implemented.

3 Answers

Answered By TechieTraveler92 On

Honestly, I think you're right about those 2 blank lines being a bit much! PEP 8 recommends it, but no one says you can't disagree. Some people would say adjust your monitor settings, but that's not really a fix for the issue, right? It might be worth proposing that customizable option directly in your GitHub issue!

FunctionFanatic84 -

I totally get it! Having a high-resolution screen makes it feel even more cramped. 1 blank line does seem more practical unless you have a lot of top-level functions.

Answered By SkepticalProgrammer76 On

Conventions are there for a reason, but I get how frustrating it can feel. Just try to roll with it for now and enjoy the bigger picture. After all, there are more pressing code issues to tackle!

LineLengthLover55 -

Exactly! Focus on the important stuff instead of getting hung up on style. But it is nice to have options!

Answered By CodeCurious37 On

You could try using a different formatter if Ruff doesn't fit your needs. Some folks swear by YAPF, but fair warning, it's not as streamlined as Ruff. If you want more control over formatting rules, that could be a route to consider, even if it can be a hassle.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.