How to enforce coding styles across a team (gomakethings.com)
from mac@programming.dev to programming@programming.dev on 17 Jan 2024 00:57
https://programming.dev/post/8696286

#programming

threaded - newest

BeefPiano@lemmy.world on 17 Jan 2024 02:36 next collapse

Nah, Prettier on save.

BatmanAoD@programming.dev on 17 Jan 2024 03:50 next collapse

…why not both? An auto-formatter for personal use, a linter for CI checks on PRs.

Bogasse@lemmy.ml on 17 Jan 2024 06:19 collapse

I agree : CI is required as a safety belt and then contributers can choose the workflow they prefer : format on save, manual invoke, precommit, …

mvirts@lemmy.world on 18 Jan 2024 02:49 collapse

Agreed, just run it all through a formatter and save everyone some time. Those who break the formatter will learn to conform 🙃

xmunk@sh.itjust.works on 17 Jan 2024 07:43 next collapse

You’d be surprised what you can accomplish purely through a robust PR review process and a clear standards document.

That said, tools to enforce and autocorrect basic syntax stuff can be quite helpful.

Lmaydev@programming.dev on 21 Jan 2024 11:32 collapse

Absolutely but it can reduce a lot of work if as many things as possible are enforced before you get to that stage.

Lmaydev@programming.dev on 21 Jan 2024 11:31 collapse

I recently enforced coding standards in our c# code bases.

Basically used an editor config and project properties to enable all analysers and set all rules to warnings. Also set warnings as errors for release builds.

I’ve then been adjusting rules by hand if they’re irritating or wrong.

It’s having great results and has already caught a load of bugs.

But my god do the juniors hate it haha