Add yamllint linter to lefthook config
Context
Closes #363828 (closed)
What does this MR do?
What it looks like
yamllint is not installed locally
$ lefthook run pre-push
Lefthook v0.7.7
RUNNING HOOKS GROUP: pre-push
[...]
EXECUTE > yamllint
ERROR: yamllint is not installed. Please install the pre-requisites locally: https://docs.gitlab.com/ee/development/documentation/testing.html#install-linters
[...]
SUMMARY: (done in 8.44 seconds)
✔️ docs-metadata
✔️ markdownlint
✔️ vale
✔️ danger
🥊 yamllint
yamllint is installed locally
$ lefthook run pre-push
Lefthook v0.7.7
RUNNING HOOKS GROUP: pre-push
[...]
EXECUTE > yamllint
[...]
SUMMARY: (done in 7.44 seconds)
✔️ vale
✔️ markdownlint
✔️ yamllint
✔️ docs-metadata
✔️ danger
How to set up and validate locally
Check the error message when yamllint is not installed locally
- Checkout the branch for this MR
- Uninstall yamllint
- Run
bundle exec lefthook run pre-push
- You should see a nice error message with a link to the docs
- Install yamllint
- Run
bundle exec lefthook run pre-push
- The linting should run for yamllint.
Check that the lefthook addition works as expected
- Checkout the branch for this MR
- Follow the documentation to install
yamllint
locally - Change a YAML file with a valid change
- Make a commit
- Run
bundle exec lefthook run pre-push
- You should see a successful entry for
yamllint
- You should see a successful entry for
- Change a YAML file with an invalid change
- Make a commit
- Run
bundle exec lefthook run pre-push
- You should see a failed entry for
yamllint
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR. -
Mention this change in the #development channel -
Mention this change in EWIR
Communication
Hi all,
TL;DR: brew install yamllint
In !88909 (merged), we have introduced a YAML linter to lefthook. If you are using lefthook, you will have to install yamllint
locally. On a mac setup, brew install yamllint
should do the trick.
Edited by David Dieulivol