diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 36e74f9c630f9b67084e6bb33995988db413c86e..f2941a12ca98ab9ab6e2aa3a17f0a672799209c8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,13 +1,24 @@ +# vim:ff=unix ts=2 sw=2 ai expandtab +--- repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v1.4.0 - hooks: - - id: check-added-large-files - - id: check-yaml - - id: check-merge-conflict - - id: flake8 -- repo: https://www.shore.co.il/git/shell-pre-commit/ - rev: v0.6.0 - hooks: - - id: shell-lint - files: ansible-vault-check + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.5.0 + hooks: + - id: check-added-large-files + - id: check-merge-conflict + - id: detect-private-key + - id: trailing-whitespace + - repo: https://github.com/Lucas-C/pre-commit-hooks-markup + rev: v1.0.0 + hooks: + - id: rst-linter + - repo: https://github.com/adrienverge/yamllint + rev: v1.21.0 + hooks: + - id: yamllint + - repo: https://github.com/amperser/proselint/ + rev: 0.10.2 + hooks: + - id: proselint + types: [plain-text] + exclude: LICENSE|requirements diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml deleted file mode 120000 index 4641bf3cbe1336d757e3bf0cde6690e210f612f9..0000000000000000000000000000000000000000 --- a/.pre-commit-hooks.yaml +++ /dev/null @@ -1 +0,0 @@ -hooks.yaml \ No newline at end of file diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1fd8ed11801ea599a43ffb28f7e3eda5973f62d9 --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,15 @@ +--- +- id: ansible-syntax-check + name: Syntax check Ansible playbooks + description: Check Ansible playbooks for syntax errors. + language: python + entry: ansible-playbook + files: playbook.yml + args: ['--inventory=localhost,', '--syntax-check'] +- id: ansible-vault-check + name: Verify vaulted files + description: Verify that Ansible Vault files are vaulted. + language: pygrep + files: vault + entry: |- + ANSIBLE_VAULT diff --git a/.travis.yml b/.travis.yml index 4f7116e45e2d17b4e3c80fc84a98c8f88fe8a148..3dc7fc43954819da7043b0dc7782f44222036a34 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,12 @@ --- language: python -python: ["2.7", "3.4", "3.5", "3.6"] +python: + - "2.7" + - "3.4" + - "3.5" + - "3.6" + - "3.7" + - "3.8" dist: trusty sudo: false group: beta diff --git a/README.rst b/README.rst index feac6e866571d8603faccb4589ab851204cc1ff6..6522788c4515032fdbc2d5a661bcc462ddd0a96f 100644 --- a/README.rst +++ b/README.rst @@ -14,7 +14,7 @@ Ansible `pre-commit <http://pre-commit.com/>`_ hooks. Requirements ------------ -- Pre-commit. +- Pre-commit 1.2 or later. - Python 2.7 or 3.4 or later. Installation @@ -25,7 +25,7 @@ Add the following to your :code:`.pre-commit-config.yaml`: .. code:: yaml - repo: https://www.shore.co.il/git/ansible-pre-commit/ - sha: v0.6.0 + sha: v0.9.0 hooks: - id: ansible-syntax-check files: site.yml #In case you want to specify other playbook files. diff --git a/ansible-vault-check b/ansible-vault-check deleted file mode 100755 index 41aa16cba0d3f7cc5ff7ed90995925e88c9a1faf..0000000000000000000000000000000000000000 --- a/ansible-vault-check +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -set -eu -for filename in $@ -do - grep -q ANSIBLE_VAULT "$filename" || \ - (echo "$filename is not vaulted." && exit 1) -done diff --git a/hooks.yaml b/hooks.yaml deleted file mode 100644 index 593d42e2a9b93ac7af3a17d21b87e326f1c31c39..0000000000000000000000000000000000000000 --- a/hooks.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- id: ansible-syntax-check - name: Syntax check Ansible playbooks - description: Check Ansible playbooks for syntax errors. - language: python - entry: ansible-playbook - files: playbook.yml - args: ['--inventory=localhost,', '--syntax-check'] -- id: ansible-vault-check - name: Verify vaulted files - description: Verify that Ansible Vault files are vaulted. - language: script - entry: ansible-vault-check - files: vault diff --git a/setup.py b/setup.py index f0e4be27bbea09a87e896fbf574d3af7c02238b6..cbbe0dae6b983e4e1c86ca36374579ab6291893c 100644 --- a/setup.py +++ b/setup.py @@ -2,10 +2,10 @@ from setuptools import setup setup( - name='pre_commit_ansible_dummy_package', - url='https://www.shore.co.il/git/ansible-pre-commit', - author='Nimrod Adar', - author_email='nimrod@shore.co.il', - version=open('VERSION', 'r').read().strip(), - install_requires=['ansible==2.6.2'], + name="pre_commit_ansible_dummy_package", + url="https://www.shore.co.il/git/ansible-pre-commit", + author="Nimrod Adar", + author_email="nimrod@shore.co.il", + version=open("VERSION", "r").read().strip(), + install_requires=["ansible==2.9.6"], )