4 ms·
Sometimes there are situational choices that autoformatters cannot comprehend. I also failed to make formatters follow the style choices I use, they were just n
by leduyquang753 3y ago
Sometimes there are situational choices that autoformatters cannot comprehend. I also failed to make formatters follow the style choices I use, they were just not configurable enough.
- kstrauser 3y ago> Sometimes there are situational choices that autoformatters cannot comprehend. I haven't stumbled across that. Could you give an example? > I also failed to make formatters follow the style choices I use, they were just not configurable enough. That's kind of the whole point. I love, love, love Python's Black formatter. In my opinion, it chose the wrong default for quoting strings (i.e. it re-writes single quotes as double quotes), which irked me until I gave up and accepted it. In return, I no longer have to put up with my coworkers' insane style choices, just as they no longer have to tolerate mine. With a single addition to our CI pipeline, the days of dumb arguments about the "right" way to format our code came to an end.
- codetrotter 3y agoLikewise with rustfmt I apply zero customization to it. If rustfmt thinks the code should be formatted some way, so be it. I have other things to spend my energy on, unrelated to any particular formatting choices.
- kstrauser 3y agoSame here. "OK, this is what Rust is supposed to look like? Fine." And now I never have to think about it again.
- secondcoming 3y ago> Could you give an example? One thing clang-format ruined for me is when I laid code out in the same indentation as the JSON it was generating. E.g. json .startObject("root") .startArray("data") .insert(1) .endArray() .endObject(); became json .startObject("root") .startArray("data") .insert(1) .endArray() .endObject();
- leduyquang753 3y ago> I gave up and accepted it. Some people also said "just accept it" and that's part of why I ditched it. If it can be helped I do not accept it. This is not limited to code formatters, I want to have control over the things I personally use. I want to be comfortable doing my stuff.
- kstrauser 3y agoYou've gotta choose your battles. In all the ways I might want to express myself with a computer, the exact formatting of my code is almost never one of them.
- refactor_master 3y agoIn our code base every “fmt: off” is compensating for a lack of scopes, smaller functions, variables, etc. Instead of cutting down on repetition we have dozens of consecutive lines of repetition. But nicely formatted repetition. Until that inevitable day where you have to change something, and everything breaks because you’re only supposed to change 90 of the 100 almost identical lines.