From 6da26cca6a3b3ac89137d81b837633358c534396 Mon Sep 17 00:00:00 2001 From: Dafydd Jones Date: Fri, 10 Jul 2020 01:00:00 +0100 Subject: [PATCH] ci(travis): run linters using `pre-commit` --- .pre-commit-config.yaml | 11 ++++++++--- .travis.yml | 7 +++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fee836df..528f996b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,13 +5,18 @@ # See https://pre-commit.com/hooks.html for more hooks default_stages: [commit] repos: - - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook - rev: v2.2.3 + - repo: https://github.com/dafyddj/commitlint-pre-commit-hook + rev: v2.3.0 hooks: - id: commitlint - name: Check commit message against @commitlint/config-conventional rules + name: Check commit message using commitlint + description: Lint commit message against @commitlint/config-conventional rules stages: [commit-msg] additional_dependencies: ['@commitlint/config-conventional@8.3.4'] + - id: commitlint-travis + stages: [manual] + additional_dependencies: ['@commitlint/config-conventional@8.3.4'] + always_run: true - repo: https://github.com/jumanjihouse/pre-commit-hooks rev: 2.1.3 hooks: diff --git a/.travis.yml b/.travis.yml index 43158df6..bee439ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,9 @@ jobs: # Run all of the linters in a single job - language: 'node_js' node_js: 'lts/*' + cache: + directories: + - $HOME/.cache/pre-commit env: 'Lint' name: 'Lint: salt-lint, yamllint, rubocop, shellcheck & commitlint' before_install: 'skip' @@ -54,6 +57,10 @@ jobs: - npm i -D @commitlint/config-conventional @commitlint/travis-cli - commitlint-travis + # Install and run `pre-commit` + - pip install pre-commit + - pre-commit run --all-files --verbose + - pre-commit run --hook-stage manual --verbose commitlint-travis ## Define the rest of the matrix based on Kitchen testing # Make sure the instances listed below match up with