Git Hooks: Autoformat before commit

Git Hooks: Autoformat before commit

Autoformatters can be great, keeping diffs small and a code base readable across teams and engineers. Black formatting has been enforced in Lobit builds since day one and I recently added it to the repos at Downstream as well. But what isn't great is forgetting to run the formatter, having the CI build fail, and having to add a "Formatting" commit. That's where Git Hooks come in. Git hooks are stored in .git/hooks folder of any given Git project. There should be some samples pre-populated. For our purposes, pre-commit is the hook of interest. Lets focus on…

Read More