Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow to use older pre-commit hook version
With b93cc58 ("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] pre-commit/pre-commit#2732 [2] pre-commit/pre-commit#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: b93cc58 ("fix: set default pre-commit hook stages to pre-commit..") Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
- Loading branch information