Hacker News new | ask | show | jobs
by __derek__ 3567 days ago
It's unusual to have style guides, in particular as extensive as this, except at places that have their act together.[1] Where some sort of style is enforced, though, it's typical to have an automated tool that validates your code. This can happen locally (as a pre-commit hook), remotely when you push a branch (as a CI check), or when merging to master (same). If people are going through and noting style guide violations in a code review, that's generally a bad sign.[2]

[1]: This is my opinion. Anecdotally, places with style guides tend to have better engineering cultures.

[2]: Again, opinion. This tends to indicate a weak culture (dictatorial lead or a lack of awareness/ability when it comes to tools) and can produce a negative atmosphere (nit-picking isn't fun).

1 comments

That's really interesting, first I have heard about automated tools to validate code.

Are there public tools out there you can use prior to commits for this purpose or are they generally done in-house?

The big one for Git is Overcommit[1]. The tools that it runs depend on the language, though. Some are community-driven[2], while others are baked into the language.[3]

[1]: https://github.com/brigade/overcommit

[2]: E.g., flake8 for Python: https://pypi.python.org/pypi/flake8

[3]: E.g., gofmt for Go: https://golang.org/cmd/gofmt/