Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

  > People who stress over code style, linting rules, or other minutia are insane weirdos
I suspect this has to do with a combination of personal preference and never having worked with a reliable (in terms of just never changing the semantics) code formatter like Black. Sure, I don't agree with every single thing Black does, but it's still infinitely better than trying to enforce code style manually. And don't get me started about those who just don't want a code style enforced - the diffs end up a serious mess, and forget dealing with merge conflicts in a reasonable time.


I think this is a nuanced point.

Enforcing code style manually probably means not enforcing code style (at best, selective enforcement). But, I've yet to see a good tool that only enforces format on new/changed lines; and a reformat en masse is asking for trouble.

However, the arguments about a consistent style giving you benefits seems to fall flat when you've got dependencies that don't follow your style. If you're in go, and everyone uses gofmt, and always has, I guess that solves that. But you probably still have some code that's not in go (the OS you run on, at least), and that's probably not consistent. And if you're not in Go, you may have a different required style than your libraries and your language environment and nothing is consistent anyway; so why enforce anything beyond best effort blend in with the surrounding context?


I’m the kinda of guy who has a strict linter and will force you to rewrite every PR you submit, but the result is that most of the time better style means you see the problems better and very often the diff (or additional code) is halved.

I could merge that PR as is because it seems to work, but I don’t because I don’t want to deal with those hidden bugs in 10 days on production.


Yeah this is the one point I don’t get. I’m not sure what “stress over it” means here. I don’t know why I’d stress over it. I’d stress over having indeterminate and mixed styles. Strict style greatly lowers mental overhead, particularly on a team (esp if larger) where one person needs to jump in and work on code others wrote.


Notice the author said people who stress over code style. Using a code formatter and forgetting about it is a great way to not stress about it. Fighting with your tools or your team to get things a certain way is where the folly is, I think, and that's how I interpreted their comment.




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

Search: