1Install pre-commit Hook for ESP-IDF Project 2=========================================== 3 4Required Dependency 5------------------- 6 7Python 3.6.1 or above. This is our recommendation python version for IDF developers. 8 9If you still have python versions not compatible, please do not install pre-commit hook and update your python versions. 10 11Install pre-commit 12------------------ 13 14Run ``pip install pre-commit`` 15 16Install pre-commit hook 17----------------------- 18 191. Go to the IDF Project Directory 20 212. 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`` 22 233. pre-commit hook will run automatically when you're running ``git commit`` command 24 25Uninstall pre-commit 26-------------------- 27 28Run ``pre-commit uninstall`` 29 30What's More? 31------------ 32 33For detailed usage, please refer to the documentation of pre-commit_. 34 35.. _pre-commit: https://www.pre-commit.com/ 36 37Common Problems For Windows Users 38--------------------------------- 39 40``/usr/bin/env: python: Permission denied.`` 41 42 If you're in Git Bash or MSYS terminal, please check the python executable location by run ``which python``. 43 44 If the executable is under ``~/AppData/Local/Microsoft/WindowsApps/``, then it's a link to Windows AppStore, not a real one. 45 46 Please install python manually and update this in your ``PATH`` environment variable. 47 48 49Your %USERPROFILE% contains non-ASCII characters 50 51 ``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. 52 53 - CMD: ``set PRE_COMMIT_HOME=C:\somepath\pre-commit`` 54 - PowerShell: ``$Env:PRE_COMMIT_HOME = "C:\somepath\pre-commit"`` 55 - git bash: ``export PRE_COMMIT_HOME="/c/somepath/pre-commit"`` 56 57 58 59