Hacker News new | past | comments | ask | show | jobs | submit login

C, C++, Objective-C: clang-format

Java: Probably google-java-format

HTML, CSS, JavaScript, TypeScript, Markdown, YAML: Prettier

Python: autopep8, yapf, and black are all widely used and I don't think any of them is dominant. I personally favor black, as it's the only one of the three that strives to leave as few degrees of freedom as possible (i.e., the same source code is always formatted the same way).

Rust: rustfmt

Black seems to be the most popular these days. It's certainly the one you hear the most about and it's getting support by default in vscode and pycharm.

Since we're on the subject: I was just looking into https://standardjs.com and wondering about how others are using these kinds of tools. It seems you've made extensive use of formatters: what made you decide on the ones you listed? I like linters a lot myself, but I'm not using formatters because it is difficult to work on code after a tool has reorganized it without my understanding of what it did. However, I rarely have time to go back through and do the cleanup myself. Does using these tools save you from the "I'll go back and clean this up later." mentality?

clang-format works with Java. It’s not as great at Eclipse’s formatter, but it is quite good and I’ve never had significant issues with it.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact