From a50242e3458d5256e06bc0ebbe1a2b4b063fd875 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Fri, 10 Feb 2023 19:56:00 +0100 Subject: [PATCH] feat: add pre-commit support (#449) --- .dictionary | 1 + .pre-commit-hooks.yaml | 8 ++++++++ docs/content/usage/configuration.md | 20 ++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 .pre-commit-hooks.yaml diff --git a/.dictionary b/.dictionary index 9ad66d3..939922c 100644 --- a/.dictionary +++ b/.dictionary @@ -9,3 +9,4 @@ xoxys ansible-.+ toc GPL-3.0 +(P|p)re-(C|c)ommit diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 0000000..afd578e --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,8 @@ +--- +- id: ansible-doctor + name: ansible-doctor + description: Create annotation based documentation for your Ansible roles. + entry: ansible-doctor -f + language: python + pass_filenames: False + always_run: True diff --git a/docs/content/usage/configuration.md b/docs/content/usage/configuration.md index 9f74536..71b94aa 100644 --- a/docs/content/usage/configuration.md +++ b/docs/content/usage/configuration.md @@ -100,3 +100,23 @@ ANSIBLE_DOCTOR_CUSTOM_HEADER= ANSIBLE_DOCTOR_EXCLUDE_FILES= ANSIBLE_DOCTOR_EXCLUDE_FILES=molecule/,files/**/*.py ``` + +## Pre-Commit setup + +To use _ansible-doctor_ 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-doctor + # change ref to the latest release from https://github.com/thegeeklab/ansible-doctor/releases + rev: v1.4.8 + hooks: + - id: ansible-doctor +{{< /highlight >}} + + + +