Ask HN: Which coding guidelines do you use?

4 points by dutchbrit ↗ HN
Always interesting to see what code guidelines people use in what language.

Personally, I use the following for PHP: Basic Coding Standard: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md

Coding Style Guide: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md

7 comments

[ 2.5 ms ] story [ 28.6 ms ] thread
Oh, it's a question about PHP... Anyway, I either use the one that's official for the language, the one that applies to the project I'm just working on, or the one that seems the most sensible to me. For the latter I normally check a few very popular projects for the language and see what they agree on.
PEP 8 for Python,

Go fmt all the things

Spaces. Not tabs. No exceptions.
> No exceptions

try { ... } catch {}

Seems a bit radical, but hey, who am I to argue.

K&R braces in all things. Because that is the One True Way to do it.
You don't have to follow guidelines if you are using a modern IDE. Guidelines should follow your code. VS 2012 + ReSharper.