2 ms·
Also, sometimes the formatting simply makes reading something messy merely tractable, not aesthetically pleasing. Once, a product launch depended on me urgentl
by neilv 2y ago
Also, sometimes the formatting simply makes reading something messy merely tractable, not aesthetically pleasing.
Once, a product launch depended on me urgently kludging a device driver in Python (long story). And this involved a large hand-maintained mapping table. I wrote it quickly but carefully, and found some formatting that made the table readable enough, without implementing a minilanguage in Python.
But the Black formatter had been rigged to run automatically on commit, so... poof! :)
- tczMUFlmoNk 2y agoBlack supports ignoring sections with a `# fmt: off` directive, and a hand-formatted constant table is a common use for that: https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#ignoring-sections https://black.readthedocs.io/en/stable/usage_and_configurati... Other formatters have similar functionality; e.g.: - /* prettier-ignore */: https://prettier.io/docs/en/ignore.html#javascript https://prettier.io/docs/en/ignore.html#javascript - #[rustfmt::skip]: https://github.com/rust-lang/rustfmt?tab=readme-ov-file#tips https://github.com/rust-lang/rustfmt?tab=readme-ov-file#tips
- neilv 2y agoThank you, that'll come in handy again, I'm sure.