- id: check-added-large-files args: ['--maxkb=1000'] exclude: "notebooks/tagifai.ipynb" ... 一定要探索许多其他内置的钩子,因为在项目中使用了一些非常有用的钩子。例如,check-merge-conflict查看是否存在任何挥之不去的合并冲突字符串,或者detect-aws-credentials是否不小心将凭据暴露在文件中,等等。 _...
目录 收起 pre-commit 的安装 pre-commit 的 配置 pre-commit 的基本使用 代码质量在很大程度上决定了开源项目的生命力,而pre-commit 配合 flake8、isort、yapf、mdformat、codespell、docformatter、docformatter 和 check-copyright 能很好的约束代码的质量。掌握 pre-commit 是一名工程师的基本素养。 pre-com...
~/work/hook-repo $ git checkout origin/main -b feature # ... make some changes # In another terminal or tab ~/work/other-repo $ pre-commit try-repo ../hook-repo foo --verbose --all-files === Using config: === repos: - ...
check-byte-order-marker: 检查文本文件中的字节顺序标记(BOM) check-case-conflict: 扫描代码库的文件名和路径,检查代码库中的文件名和路径的大小写冲突 check-docstring-first: 检查Python函数或方法的文档字符串(docstring)是否在定义的时候放置在首行 check-executables-have-shebangs: 检查可执行文件是否包含正确的...
…ke fmt-al' (HumanSignal#5819) When you execute `pre-commit run --hook-stage manual "biome-check" --config .pre-commit-dev.yaml --all-files` for example using 'make fmt-al' biome hangs because files outside the main configuration are being pass. Co-authored-by: Raul Martin <raul@...
- id: check-docstring-first - id: debug-statements - repo: https://github.com/asottile/pyupgrade rev: v2.37.3 rev: v3.3.1 hooks: - id: pyupgrade args: [--py37-plus] - repo: https://github.com/pycqa/isort rev: 5.10.1 rev: 5.12.0 hooks: - id: isort args: [ @@ -32,...
"1>&2exit1fi# Make sure that all files to be committed are encoded in UTF-8.whileread changeline;do# Get just the file (not the add / update / etc. status).file=${changeline:4}# Only check source files.if[[$file==*.java||$file==*.xhtml||$file==*.css||$file==*.xml||...
on: push: branches: - main jobs: pre-commit-check: runs-on: ubuntu-latest steps: - uses: actions/setup-python@v4 with: python-version: 3.9 - name: Install pre-commit run: pip install pre-commit - name: Run pre-commit run: pre-commit run --all-files 常见问题与解决策略 pre-commit ...
post-rewrite钩子被那些会替换提交记录的命令调用,比如git commit --amend和git rebase(不过不包括git filter-branch)。 它唯一的参数是触发重写的命令名,同时从标准输入中接受一系列重写的提交记录。 这个钩子的用途很大程度上跟post-checkout和post-merge差不多。
post-rewrite钩子被那些会替换提交记录的命令调用,比如git commit --amend和git rebase(不过不包括git filter-branch)。 它唯一的参数是触发重写的命令名,同时从标准输入中接受一系列重写的提交记录。 这个钩子的用途很大程度上跟post-checkout和post-merge差不多。