From f00d8a34b74698c8c1593e951023c17c5db347a0 Mon Sep 17 00:00:00 2001 From: TribuneX Date: Fri, 17 Jan 2025 00:09:05 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20add=20pre-commit=20hook=20c?= =?UTF-8?q?onfig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-hooks.yaml | 6 ++++++ website/docs/index.md | 12 ++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 .pre-commit-hooks.yaml diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 0000000..1845353 --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,6 @@ +- id: git-sumi + name: Lint commit message with git sumi + description: Lints each new commit with git sumi based on the configured project rules in your sumi.toml + entry: git-sumi --file + language: rust + stages: [prepare-commit-msg] diff --git a/website/docs/index.md b/website/docs/index.md index f646e4b..b447073 100644 --- a/website/docs/index.md +++ b/website/docs/index.md @@ -75,6 +75,18 @@ git sumi -c '🎨 refactor: format JS with Prettier' If your message passes all rules, it will be committed. Otherwise, you'll see what went wrong. +### Using pre-commit + +You can also integrate git-**sumi** via [pre-commit](https://pre-commit.com/#intro) by adding the following hook to your pre-commit config: + +```yaml +repos: +- repo: https://github.com/welpo/git-sumi + rev: v0.1.0 # check latest version: https://github.com/welpo/git-sumi/tags + hooks: + - id: git-sumi +``` + ## Contributing Please do! We appreciate bug reports, improvements to documentation (however minor), feature requests, code contributions… To get started, take a look at the [contributing guidelines](https://github.com/welpo/git-sumi/blob/main/CONTRIBUTING.md).