2020-10-30 11:31:55 +00:00
Install pre-commit Hook for ESP-IDF Project
===========================================
2020-11-04 02:23:47 +00:00
Required Dependency
-------------------
2022-01-31 06:20:59 +00:00
Python 3.7.* or above. This is our recommended python version for IDF developers.
2020-11-04 02:23:47 +00:00
2021-12-20 10:48:15 +00:00
If you still have python versions not compatible, update your python versions before installing the pre-commit hook.
2020-11-04 02:23:47 +00:00
2020-10-30 11:31:55 +00:00
Install pre-commit
------------------
Run `` pip install pre-commit ``
Install pre-commit hook
-----------------------
1. Go to the IDF Project Directory
2. Run `` pre-commit install --allow-missing-config `` . Install hook by this approach will let you commit successfully even in branches without the `` .pre-commit-config.yaml ``
3. pre-commit hook will run automatically when you're running `` git commit `` command
2021-04-19 10:14:25 +00:00
Uninstall pre-commit
--------------------
Run `` pre-commit uninstall ``
2020-10-30 11:31:55 +00:00
What's More?
------------
2021-09-08 15:38:14 +00:00
For detailed usage, please refer to the documentation of pre-commit_.
2020-10-30 11:31:55 +00:00
2022-04-28 06:34:20 +00:00
.. _pre-commit: https://pre-commit.com/
2020-10-30 11:31:55 +00:00
Common Problems For Windows Users
---------------------------------
2021-09-08 15:38:14 +00:00
`` /usr/bin/env: python: Permission denied. ``
2020-10-30 11:31:55 +00:00
2021-11-09 12:10:56 +00:00
If you're in Git Bash, please check the python executable location by run `` which python `` .
2020-10-30 11:31:55 +00:00
If the executable is under `` ~/AppData/Local/Microsoft/WindowsApps/ `` , then it's a link to Windows AppStore, not a real one.
Please install python manually and update this in your `` PATH `` environment variable.
2021-09-08 15:38:14 +00:00
Your %USERPROFILE% contains non-ASCII characters
`` pre-commit `` may fail when initializing an environment for a particular hook when the path of `` pre-commit `` 's cache contains non-ASCII characters. The solution is to set `` PRE_COMMIT_HOME `` to a path containing only standard characters before running pre-commit.
- CMD: `` set PRE_COMMIT_HOME=C:\somepath\pre-commit ``
- PowerShell: `` $Env:PRE_COMMIT_HOME = "C:\somepath\pre-commit" ``
- git bash: `` export PRE_COMMIT_HOME="/c/somepath/pre-commit" ``