提问人:user2439278 提问时间:10/20/2023 最后编辑:anthony sottileuser2439278 更新时间:10/20/2023 访问量:42
如何在 Gitlab 的 fastapi 预提交钩子中设置条件
how to have condition in the fastapi pre-commit hook in Gitlab
问:
我创建了一个 fastapi 预提交钩子,用于检查 python 代码中的 linting 和格式。 我还添加了一个脚本,该脚本在提交期间递增应用程序版本。即使 linter 失败并阻止提交,版本也会递增。
repos:
- repo: https://github.com/psf/black
rev: 23.10.0
hooks:
- id: black
args: ["--check"]
- repo: local
hooks:
- id: flake8
name: flake8
entry: flake8
language: system
args: ["--output-file=report.xml"]
files: app
- repo : local
hooks:
- id: pylint
name: pylint
entry: ./scripts/pylint_precommit.sh 9.5
language: script
- repo : local
hooks:
- id: VersionIncrement
name: VersionIncrement
entry: ./scripts/version.sh
language: script
如何添加条件,仅在 linters,formatters 在 pre-commit 钩子中传递时才增加版本
答: 暂无答案
上一个:运行预提交,不包括多个钩子的目录
评论