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
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@
include:
  - project: shore/ci-stuff
    file: templates/pre-commit.yml
  - project: shore/ci-stuff
    file: templates/pre-commit-repo.yml
  - project: shore/ci-stuff
    file: templates/python.yml

+5 −0
Original line number Diff line number Diff line
@@ -96,3 +96,8 @@ repos:
    rev: '0.47'
    hooks:
      - id: check-manifest

  - repo: https://github.com/pre-commit/pre-commit.git
    rev: v2.15.0
    hooks:
      - id: validate_manifest

.pre-commit-hooks.yaml

0 → 100644
+8 −0
Original line number Diff line number Diff line
---
- id: yamltool
  name: YAML tool
  description: Validate and pretty-print YAML files.
  language: python
  entry: yt
  args: ["--in-place"]
  types: [yaml]
+1 −0
Original line number Diff line number Diff line
include *.rst
include *.txt
exclude .pre-commit-config.yaml
exclude .pre-commit-hooks.yaml
exclude .gitlab-ci.yml
exclude .gitignore
+15 −0
Original line number Diff line number Diff line
@@ -39,6 +39,21 @@ Usage
    Please note that specifying multiple input files will concatenate
    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
-------