From 9d454aae8ac8de12ddc6c7b9a9cde67682c5061a 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 | 7 +++++++ website/docs/index.md | 12 ++++++++++++ website/docs/integration.md | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) 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..a52039c --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,7 @@ +- 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 + pass_filenames: false + stages: [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). diff --git a/website/docs/integration.md b/website/docs/integration.md index c3c35cc..6ded44c 100644 --- a/website/docs/integration.md +++ b/website/docs/integration.md @@ -7,7 +7,7 @@ sidebar_position: 6 ## Local linting with Git hooks :::tip -To set up both Git hooks described below, run `git sumi --init hooks`. +To set up both Git hooks described below, run `git sumi --init hooks`. As an alternative git-**sumi** can be integrated with the [pre-commit package manager](/docs/#using-pre-commit). ::: ### commit-msg hook