From c6bcd19d0cebf1f969b594213aa39585bf9c777f Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Sun, 17 Apr 2022 23:01:10 +0200 Subject: [PATCH] Added pre-commit notes to the knowledge base --- knowledge base/pre-commit.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 knowledge base/pre-commit.md diff --git a/knowledge base/pre-commit.md b/knowledge base/pre-commit.md new file mode 100644 index 0000000..0525511 --- /dev/null +++ b/knowledge base/pre-commit.md @@ -0,0 +1,33 @@ +# Pre-commit + +## TL;DR + +```shell +# generate a very basic configuration +pre-commit sample-config > .pre-commit-config.yaml + +# manually run checks +pre-commit run --all-files # all checks +pre-commit run ansible-lint # ansible-lint only + +# automatically run checks at every commit +pre-commit install + +# update all hooks to the latest version +pre-commit autoupdate + +# skip check on commit +SKIP=flake8 git commit -m "foo" +``` + +## Further readings + +- List of [supported hooks] + +[supported hooks]: https://pre-commit.com/hooks.html + +## Sources + +- [Website] + +[website]: https://pre-commit.com