diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0ca18c5d9347929e25955437221abcce39fb8cb7..b712a2e11d5b54d102a844be63537ee6e9723c64 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 797bfc63b906b06477d6bedf2c8d937c0acc2082..418943e997cd565468680f219e6742c9963b18bb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0baf9c896d2c768840d6eb007c4a506f195783b0 --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,8 @@ +--- +- id: yamltool + name: YAML tool + description: Validate and pretty-print YAML files. + language: python + entry: yt + args: ["--in-place"] + types: [yaml] diff --git a/MANIFEST.in b/MANIFEST.in index 3db680179333f6783a5aac2ba617d805df1d44dd..4bfa04a5820f6eaeec0e68c58579d896de4b5a86 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,6 @@ include *.rst include *.txt exclude .pre-commit-config.yaml +exclude .pre-commit-hooks.yaml exclude .gitlab-ci.yml exclude .gitignore diff --git a/README.rst b/README.rst index 7520f22eb41b60b0d9cb4dabee15b216c1dc8c85..540c9358570e5638aa8cfa1034458e8d6d854974 100644 --- a/README.rst +++ b/README.rst @@ -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 -------