Ask HN: Does your organization enforce a code style/formatting standard?
There's a discussion going around in management about creating a common style guide for our source code. Currently the only style that is enforced is that we use spaces instead of tabs and the length is two spaces per indentation level. Everything else is informal convention and there's a lot of subtle variation across the codebase.
We primarily use C# and SQL. I'm curious if you have to abide by a style guide and if you've encountered any pitfalls when enforcing a standard like that.
8 comments
[ 3.4 ms ] story [ 32.3 ms ] threadIt's a bit uncomfortable at first when you can't use your favorite style anymore, but the advantage of not having to think about style for me vastly outweighs the advantage of being able to code in my personal favorite style.
We use eslint with a set of airbnb and unicorn rules. We went from the recommended rules and changed a few settings. Most of the rules will reformat or fix the code automatically so it's not a huge problem during development. If it's not automatically fixed, you will still have a link to the documentation explaining why the rule exists. You also cannot merge to the main branch if the linter is not happy.
And I recently started to write custom eslint rules too, it's not very difficult and it's fun.