From ee4abf7dd7aa7ffcac279f8a428f1af820a5fdfb Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Sat, 30 Mar 2019 21:14:18 -0400 Subject: [PATCH] Replace coala commit-msg hook with pre-commit Idea here is to replace the slow coala checker with the much faster pre-commit hooks in the future as we replace the different linters we're using via coala with pre-commit versions. Using this requires the developer to setup pre-commit on their local dev environment to initialize this the first time the contribute to this repo. Install can be performed via one of the following methods: 1) Install pre-commit from your local package manager then run: pre-commit install --hook-type commit-msg 2) Run `tox -e check-hooks` Change-Id: I5b5d3dcbd7d83e90322f63ba99fa1f76c88ee8ad Signed-off-by: Thanh Ha --- .coafile | 8 -------- .pre-commit-config.yaml | 6 ++++++ tox.ini | 11 +++++------ 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/.coafile b/.coafile index 8a2fa26..edba4bd 100644 --- a/.coafile +++ b/.coafile @@ -10,14 +10,6 @@ ignore = .tox/**, bears = WriteGoodLintBear files = docs/**.rst -[all.Git] -bears = GitCommitBear -ignore_length_regex = Signed-off-by, - Also-by, - Co-authored-by, - http://, - https:// - [all.Python] bears = BanditBear, PEP8Bear, diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ce05348..c52b437 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,3 +4,9 @@ repos: rev: v1.3.0 hooks: - id: trailing-whitespace + + - repo: https://github.com/jorisroovers/gitlint + rev: v0.11.0 + hooks: + - id: gitlint + diff --git a/tox.ini b/tox.ini index ab77912..2550e36 100644 --- a/tox.ini +++ b/tox.ini @@ -13,12 +13,6 @@ deps = commands = pytest --basetemp={envtmpdir} {posargs} -[testenv:check-hooks] -deps = pre-commit -commands = - pre-commit install - pre-commit run --all-files - [testenv:coala] basepython = python3 deps = @@ -43,6 +37,11 @@ deps = -rdocs/requirements.txt commands = sphinx-build -j auto --keep-going -W -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck +[testenv:pre-commit] +deps = pre-commit +commands = + pre-commit install --hook-type commit-msg + pre-commit run --all-files [testenv:reno] deps = -rdocs/requirements.txt -- 2.16.6