自定义pre-commit 开发格式简单说明

内容来自官方文档,主要是简单说明下,方便学习

约定

git 项目需要包含.pre-commit-hooks.yaml 文件,里边内容格式如下

-   id: trailing-whitespace
    name: Trim Trailing Whitespace
    description: This hook trims trailing whitespace.
    entry: trailing-whitespace-fixer
    language: python
    types: [text]

比较重要的参数,id, name,language,entry,id 是唯一id,name 主要是在执行的时候方便显示,entry 是执行点,执行语言

说明

详细的可以参考官方文档,了解hooks 开发的格式要求有助于开发自己的

参考资料

https://pre-commit.com/#creating-new-hooks
https://pre-commit.com/#pre-commit-configyaml---hooks

posted on 2024-04-16 19:38  荣锋亮  阅读(29)  评论(0编辑  收藏  举报

导航