Replies: 6 comments 11 replies
-
Brilliant! Thanks for the ping! I'll give it a try. Many of the projects I work with are much bigger so I can't control a change away from black, but I'll give this a go with new projects! 🙏 |
Beta Was this translation helpful? Give feedback.
-
@jsh9 does this also do extra indentation for line continuation in general? ie I like to use 8 spaces not just for function def but function calls, multi-line conditionals, etc. |
Beta Was this translation helpful? Give feedback.
-
about damn time that someone resists that formatting cult that is black. Well done. |
Beta Was this translation helpful? Give feedback.
-
Hi @veritas9872, @nilsbunger: I saw your posts (astral-sh/ruff#1904 (comment)) and/or upvote to request extra indentation in the function argument list. In particular, @veritas9872 mentioned here that:
In fact, it is not difficult to implement, and it is not disruptive. I forked Please feel free to check out https://github.com/jsh9/cercis, and the option I added is : --function-definition-extra-indent. My fork is on top of the latest changes of Please feel free to take a look and provide feedback if any! |
Beta Was this translation helpful? Give feedback.
-
Hi @jni, @flexatone, @Martmists-GH, @stefanoborini, @mintchkin, @nbievre, @veritas9872, @nilsbunger: Ruff is implementing a Python code formatter, and I think the authors of Ruff are open-minded about adding configuration options. If you'd like this 8-space indentation feature implemented in Ruff, would you mind going to upvote my comment here:: astral-sh/ruff#1904 (comment) Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi @LeonarddeR, welcome to the club! Please take a look at this discussion thread and the repo. |
Beta Was this translation helpful? Give feedback.
-
Hi @jni, @flexatone, @Martmists-GH, @stefanoborini, @mintchkin, @nbievre:
I recently forked Black and wrote a more configurable Python code formatter (named "Cercis": https://github.com/jsh9/cercis), because I do not agree with this particular style choice of Black, and Black does not offer customization for it:
After some Googling, I think you share the same style opinion as I do. Here are the posts that I looked at:
Cercis does this out of the box:
It is controlled by an option
--function-definition-extra-indent
, which is by defaultTrue
.With the
--closing-bracket-indentation
option set toTrue
(by default, this option isFalse
), we can get this:If you are still interested in implementing this style in your code, please feel free to try it out, and any feedback would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions