安装 pre-commit
sudo apt install pre-commit -y
repos:
- repo: https://github.com/python/black
rev: 23.3.0
hooks:
- id: black
language_version: python3
exclude: src/ratel/pot
args: ["--line-length", "180"]
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: [ "--profile", "black", "--filter-files" ]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.0
hooks:
- id: prettier
files: ^mark_data/
types: [ json ]
args: [ "--print-width", "12" ]
标签:pre,格式化,python,hooks,代码,rev,--,black,id
From: https://www.cnblogs.com/rush-peng/p/17432726.html