mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 09:09:10 -04:00
fix: allow to use older pre-commit hook version
With b93cc581a5d6 ("fix: set default pre-commit hook stages to pre-commit..") a dependency on pre-commit 3.3 was added. As it turned out, there are people still using e.g. 2.16 version and this change is causing problems. 1. The minimum_pre_commit_version is checked after the config is parsed. Meaning if there is a problem in the config file, like unknown pre-commit for default_stages, pre-commit exits with an error not suggesting that it should be updated. 2. "pre-commit" was added in 3.2 for consistency with git hook names and we can use "commit" instead avoiding dependency on newer pre-commit. For more info please see [1] and [2]. 3. default_install_hook_types[4] were added in 2.18.0[3]. This was IMHO actually a nice feature to have in our .pre-commit-config.yaml, because it specifies which hooks should be installed when pre-commit install is executed. Meaning it's not necessary to list the stages explicitly with the -t options. Anyway we haven't used this feature till now, so it hopefully should not be a problem if we remove it again. With this change we can still avoid to start pre-commit plugins multiple times for different stages, but also make it compatible with older versions(2.16). [1] https://github.com/pre-commit/pre-commit/issues/2732 [2] https://github.com/pre-commit/pre-commit/pull/2808 [3] https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md#2180---2022-04-02 [4] https://pre-commit.com/#top_level-default_install_hook_types Fixes: b93cc581a5d6 ("fix: set default pre-commit hook stages to pre-commit..") Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
parent
3cd7fb6321
commit
09ba070b7e
@ -1,9 +1,7 @@
|
||||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
|
||||
minimum_pre_commit_version: 3.3.0
|
||||
default_install_hook_types: [pre-commit, post-commit, commit-msg]
|
||||
default_stages: [pre-commit]
|
||||
default_stages: [commit]
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
|
Loading…
x
Reference in New Issue
Block a user