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

I first encountered this when I began working in golang because it was batteries included with go fmt.

I know this makes me late to the party, so can anyone comment on similarly dominant/official tools in their language of professional experience?

A web search can find tools, but it’s hard to know when one is likely to be “blessed” by potential future project teams.




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.


Black is written by python core devs AFAIK (pip install black).


I love it so much because you cannot configure it much, so it defines a clear standard that everybody can depend on



For Javascript, ESLint and Prettier are the most used (can be used together)

Flake8 + Black for Python do a good job


On my case,

C++, .NET languages, TypeScript, JavaScript: Default Visual Studio/VSC configuration

Java: Eclipse/Netbeans/InteliJ configured for Sun's conventions


I use go fmt and editor config together. Gotta tame the white space locally. All them tabs give me whiplash.




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

Search: