From 2191e711a26c4e18e5c7978a18acdba7ccc32cb1 Mon Sep 17 00:00:00 2001 From: Lyz Date: Fri, 5 Feb 2021 13:12:40 +0100 Subject: [PATCH] feat: allow the use of yamlfix as a pre-commit hook Closes #10 --- .pre-commit-hooks.yaml | 10 ++++++++++ docs/editor_integration.md | 22 ++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 .pre-commit-hooks.yaml diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 0000000..acf1d79 --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,10 @@ +--- +- id: yamlfix + name: yamlfix + entry: yamlfix + require_serial: true + language: python + language_version: python3 + types_or: [cython, pyi, python] + args: [] + minimum_pre_commit_version: 2.9.0 diff --git a/docs/editor_integration.md b/docs/editor_integration.md index ff05b96..80a5cab 100644 --- a/docs/editor_integration.md +++ b/docs/editor_integration.md @@ -1,5 +1,5 @@ -For a smother experience, you can run `yamlfix` each time you save your file -in your editor. +For a smoother experience, you can run `yamlfix` automatically each time each +time you save your file in your editor or when you run `git commit`. # Vim @@ -12,3 +12,21 @@ plugin](https://github.com/dense-analysis/ale). post](https://lyz-code.github.io/blue-book/linux/vim/vim_plugins/#ale). `ale` is configured to run `yamlfix` automatically by default. + +# [pre-commit](https://pre-commit.com/) + +You can run `yamlfix` before we do a commit using the +[pre-commit](https://pre-commit.com/) framework. If you don't know how to use +it, follow [these +guidelines](https://lyz-code.github.io/blue-book/devops/ci/#configuring-pre-commit). + +You'll need to add the following lines to your project's +`.pre-commit-config.yaml` file. + +```yaml +repos: + - repo: https://github.com/lyz-code/yamlfix/ + rev: master + hooks: + - id: yamlfix +```