From 334ed1da8ca2bf5a86cb2dd9c68a3067b2fdab8b Mon Sep 17 00:00:00 2001 From: Sergey Ivanov Date: Sat, 24 Jul 2021 17:17:38 +0100 Subject: [PATCH] Add system pre-commit hook --- .pre-commit-hooks.yaml | 12 ++++++++++-- README.md | 15 +++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 2e3157e..9b36e3b 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,7 +1,15 @@ +--- - id: editorconfig-checker - name: editorconfig-checker + name: 'Check .editorconfig rules' description: '`editorconfig-checker` is a tool to check if your files consider your .editorconfig-rules.' entry: ec language: python - types: [text] + types: [ text ] + require_serial: true +- id: editorconfig-checker-system + name: 'Check .editorconfig rules' + description: 'Runs system executable of `editorconfig-checker` to lint text files according to `.editorconfig` rules' + language: system + entry: ec + types: [ text ] require_serial: true diff --git a/README.md b/README.md index 7468674..5f6df4c 100644 --- a/README.md +++ b/README.md @@ -32,4 +32,19 @@ repos: alias: ec ``` +The above hook is a python wrapper that automatically downloads and installs +[editorconfig-checker](https://editorconfig-checker.github.io/) binary. +If you manage your tools in some other way, for example, via [ASDF](https://asdf-vm.com/), +you may want to use an alternative pre-commit hook that assumes that +`ec` binary executable is already available on the system path: + +```yaml +repos: +- repo: https://github.com/editorconfig-checker/editorconfig-checker.python + rev: '' # pick a git hash / tag to point to + hooks: + - id: editorconfig-checker-system + alias: ec +``` + See the [pre-commit docs](https://pre-commit.com/#pre-commit-configyaml---hooks) to check how to customize this configuration.