From 106feff9bad10e256402506dec4a7f13822a82aa Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Fri, 10 Feb 2023 10:15:01 +0100 Subject: [PATCH] feat: add pre-commit support (#543) Co-authored-by: Douglas Thor --- .dictionary | 1 + .pre-commit-hooks.yaml | 10 ++++++++++ docs/content/configuration/pre-commit.md | 21 +++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 .pre-commit-hooks.yaml create mode 100644 docs/content/configuration/pre-commit.md diff --git a/.dictionary b/.dictionary index 3a26823..46d753b 100644 --- a/.dictionary +++ b/.dictionary @@ -23,3 +23,4 @@ LINT([0-9]{4}) SCM bools Check[A-Z].+ +(P|p)re-(C|c)ommit diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 0000000..036b3ad --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,10 @@ +--- +- id: ansible-later + name: ansible-later + description: Run ansible-later, a best-practice scanner for Ansible. + entry: ansible-later + language: python + pass_filenames: False + always_run: True + additional_dependencies: + - .[ansible-core] diff --git a/docs/content/configuration/pre-commit.md b/docs/content/configuration/pre-commit.md new file mode 100644 index 0000000..f56108e --- /dev/null +++ b/docs/content/configuration/pre-commit.md @@ -0,0 +1,21 @@ +--- +title: Pre-Commit setup +--- + +To use `ansible-later` with the [pre-commit](https://pre-commit.com/) framework, add the following to the `.pre-commit-config.yaml` file in your local repository. + + + + + +{{< highlight yaml "linenos=table" >}} +- repo: https://github.com/thegeeklab/ansible-later + # change ref to the latest release from https://github.com/thegeeklab/ansible-later/releases + rev: v3.0.2 + hooks: + - id: ansible-later +{{< /highlight >}} + + + +