Why don't we use an auto formatter such as Black? #3397
-
This isn't issue, I'm just curious why we don't use something like Black? I find manually formatting files tedious. I just want to sling code and let an auto formatter do the grunt work. If there's a way to automate fb code formatting so it passes pylint, I'm all ears. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 14 replies
-
No tool currently auto-formats in the style that we use here. I have considered adapting some auto formatter to enforce our code-style, but I still haven't done so. This is an example of our code-style: There are a few code-style decisions here that are not what auto-formatters would have done, but which I consider good for code legibility. I'm aware of how biased this conversation can get. I'm just not willing to change the code-style at this point. It would be much better for me to spend some time automating the existing tools to match this style instead. But let's not get distracted by this. I think the important point in your initial question is that you seem to be having trouble with pylint. Can you show me some examples of pylint complaining about your code? Is this related to your ongoing work on this pull request? (PR #3194) |
Beta Was this translation helpful? Give feedback.
-
That's fair enough and totally understandable.
I get a few nits every pr but it's nothing serious. I'm just lazy and would prefer to not even think about formatting tbh. My biggest gripe is vertical alignment e.g yield FAIL, \
Message("out-of-bounds",
"Point is out by ...") Black would instead do yield FAIL, Message(
"out-of-bounds",
"Point is out by ..."
) I get that our current version is nicer, it's just a pita when you need to refactor. |
Beta Was this translation helpful? Give feedback.
-
@felipesanches Can you please reconsider using Black?
|
Beta Was this translation helpful? Give feedback.
-
+1,000,000 I've been playing a lot with both Go and Rust and their autoformatters just make life a breeze. Life is too short for us to be caring whether a block of code could look nicer. I'd rather use that time for making cocktails, walking on the beach with my partner or smoking cigars. |
Beta Was this translation helpful? Give feedback.
-
Lots of people seem to be frustrated by fontbakery not using Black. I feel guilty of being stubborn on this matter. Let's give this another chance. I'd like to ask here what should I do to experiment with this. How can I see how it would look like? How is it setup? Can someone please, perhaps @m4rc1e, open a PR in which black is used? |
Beta Was this translation helpful? Give feedback.
-
We're currently using Black auto formatter. |
Beta Was this translation helpful? Give feedback.
We're currently using Black auto formatter.