Hacker News new | ask | show | jobs
by thewisenerd 3497 days ago
How strictly do people writing code have to adhere to styling guides (not just in NASA, but everywhere else too)?

I get that coding standards are a good thing and plain-simply following these will produce "readable" and (possibly) maintainable code, but will that make the code any _better/efficient_ ?

Though this does catch some "gotchas" in C, like the if-if-else and the #define trap, I wonder if the Code Review involves a guy rejecting my patches with the comments, "you have missed out guideline 6.4.3.5 defined in page 54".

3 comments

There is nothing more annoying than getting a PR that fixed a one line bug, along with someone's editor's autoindent rewriting the entire file the fix was in, because it wanted to change indents.

It's certainly not efficient reading a patch with a +1000/-999 diffstat, hunting for a one line fix. I've had this repeatedly and it's painful. Anyone that noted the existing style wouldn't have let this happen.

Generally, code that does not adhere to the project's style guide will not be merged until it's fixed.
If programming in Ruby, I find that rubocop can enforce our style guide programmatically and impersonally, and it can even be set up with a git commit hook. You can't push ugly syntax! It's not perfect, but it's very good with very little effort.