From 8c4854a9e88d97fb55151ff47ec6c7c60142a5c7 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Sat, 14 Oct 2023 21:06:40 +0200 Subject: [PATCH] chore: use example files as examples --- examples/dotfiles/.pre-commit-config.yaml | 45 +++++++++++++++++++++++ knowledge base/pre-commit.md | 45 ++--------------------- 2 files changed, 49 insertions(+), 41 deletions(-) create mode 100644 examples/dotfiles/.pre-commit-config.yaml diff --git a/examples/dotfiles/.pre-commit-config.yaml b/examples/dotfiles/.pre-commit-config.yaml new file mode 100644 index 0000000..fcb3573 --- /dev/null +++ b/examples/dotfiles/.pre-commit-config.yaml @@ -0,0 +1,45 @@ +--- +# File .pre-commit-config.yaml +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +# See https://github.com/pre-commit/identify/blob/main/identify/extensions.py for the list of file types by extension + +exclude: ^FIXME/.*$ # ignore all files matching the regexp +fail_fast: true # stop at the first error +repos: + - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook + rev: v9.5.0 + hooks: + - id: commitlint + stages: # limit hook to specific stages + - commit-msg + additional_dependencies: ['@commitlint/config-conventional'] + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-added-large-files + - id: check-json + - id: check-yaml + args: [--allow-multiple-documents] + - id: check-xml + - id: trailing-whitespace + args: + - --markdown-linebreak-ext=md # ignore markdown's line break + - id: end-of-file-fixer + - repo: https://github.com/markdownlint/markdownlint + rev: v0.12.0 + hooks: + - id: markdownlint + types: # limit hook to target file types + - markdown + args: + - -r "~MD013" # ignore line-length rule + - repo: https://github.com/ansible-community/ansible-lint + rev: v6.20.3 + hooks: + - id: ansible-lint + name: ansilint # use an alias + - repo: https://github.com/hadolint/hadolint + rev: v2.12.1-beta + hooks: + - id: hadolint diff --git a/knowledge base/pre-commit.md b/knowledge base/pre-commit.md index 72a2ed6..4777df5 100644 --- a/knowledge base/pre-commit.md +++ b/knowledge base/pre-commit.md @@ -28,47 +28,7 @@ pre-commit autoupdate SKIP="flake8" git commit -m "foo" ``` -```yaml ---- -# File .pre-commit-config.yaml -# See https://pre-commit.com for more information -# See https://pre-commit.com/hooks.html for more hooks -# See https://github.com/pre-commit/identify/blob/main/identify/extensions.py for the list of file types by extension - -exclude: ^FIXME/.*$ # ignore all files matching the regexp -fail_fast: true # stop at the first error -repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 - hooks: - - id: check-added-large-files - - id: check-json - - id: check-yaml - args: [--allow-multiple-documents] - - id: check-xml - - id: trailing-whitespace - args: - - --markdown-linebreak-ext=md # ignore markdown's line break - - id: end-of-file-fixer - - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook - rev: v9.5.0 - hooks: - - id: commitlint - stages: [commit-msg] # limit to specific stages - additional_dependencies: ['@commitlint/config-conventional'] - - repo: https://github.com/markdownlint/markdownlint - rev: v0.12.0 - hooks: - - id: markdownlint - types: [markdown] # limit target types - args: - - -r "~MD013" # ignore line-length rule - - repo: https://github.com/ansible-community/ansible-lint - rev: v6.19.0 - hooks: - - id: ansible-lint - name: ansilint # use an alias -``` +[Config file example]. ## Troubleshooting @@ -89,3 +49,6 @@ Check they are tracked (have been `add`ed to the repository). [file types by extension]: https://github.com/pre-commit/identify/blob/main/identify/extensions.py [supported hooks]: https://pre-commit.com/hooks.html [website]: https://pre-commit.com + + +[config file example]: ../examples/dotfiles/.pre-commit-config.yaml