pre-commit

setup

install pre-commit

$ python -m pip install --user pipx
$ pipx ensurepath
$ pipx install pre-commit

# or
$ brew install --HEAD pre-commit

init hook in repo

run

migrate-config

hooks

[!NOTE|labels:reference:]

  • sample config

  • update to repo's latest version

[!NOTE|labels:reference:]

checker and fixer

mixed-line-ending

--fix OPTIONS

COMMENTS

auto

auto-detect line-ending

no

no change line-ending

cr

force use (legacy Mac)

crlf

force use \r(Windows)

lf

force use (Unix/Linux/macOS)

convert tab to spaces

  • expand + sponge

  • python solution

typos

Last updated

Was this helpful?