Skip to content
Snippets Groups Projects
Commit 9bd965e3 authored by nimrod's avatar nimrod
Browse files

Pre-commit hook.

So now it can be used as a pre-commit hook, validating and nicely
formatting YAML files. Hurray!
parent 4dae990a
No related branches found
No related tags found
No related merge requests found
Pipeline #2550 failed
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
include: include:
- project: shore/ci-stuff - project: shore/ci-stuff
file: templates/pre-commit.yml file: templates/pre-commit.yml
- project: shore/ci-stuff
file: templates/pre-commit-repo.yml
- project: shore/ci-stuff - project: shore/ci-stuff
file: templates/python.yml file: templates/python.yml
......
...@@ -96,3 +96,8 @@ repos: ...@@ -96,3 +96,8 @@ repos:
rev: '0.47' rev: '0.47'
hooks: hooks:
- id: check-manifest - id: check-manifest
- repo: https://github.com/pre-commit/pre-commit.git
rev: v2.15.0
hooks:
- id: validate_manifest
---
- id: yamltool
name: YAML tool
description: Validate and pretty-print YAML files.
language: python
entry: yt
args: ["--in-place"]
types: [yaml]
include *.rst include *.rst
include *.txt include *.txt
exclude .pre-commit-config.yaml exclude .pre-commit-config.yaml
exclude .pre-commit-hooks.yaml
exclude .gitlab-ci.yml exclude .gitlab-ci.yml
exclude .gitignore exclude .gitignore
...@@ -39,6 +39,21 @@ Usage ...@@ -39,6 +39,21 @@ Usage
Please note that specifying multiple input files will concatenate Please note that specifying multiple input files will concatenate
them, resulting in a single file that has multiple documents. them, resulting in a single file that has multiple documents.
pre-commit hook
---------------
YAML tool can be used as a `pre-commit <https://pre-commit.com/>` hook by
adding the following to your :code:`.pre-commit-config.yaml` file:
.. code:: yaml
---
repos:
- repo: https://git.shore.co.il/nimrod/yamltool.git
rev: 0.1.0 # Check for the latest tag or run pre-commit autoupdate.
hooks:
- id: yamltool
License License
------- -------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment