From a47310fe7714fef795aaf0ccad94cb9b9ea0ee8c Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Wed, 13 Nov 2024 10:04:28 +0000 Subject: [PATCH 1/2] feat: support new hook check-merge-base --- .pre-commit-hooks.yaml | 7 +++++++ README.rst | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 0ba4a51..af2e2c8 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -34,3 +34,10 @@ args: [--commit-signoff] pass_filenames: false language: python +- id: check-merge-base + name: check merge base + description: requiring to rebase current branch onto target branch + entry: commit-check + args: [--merge-base] + pass_filenames: false + language: python diff --git a/README.rst b/README.rst index ff9c7e6..09d71eb 100644 --- a/README.rst +++ b/README.rst @@ -32,7 +32,7 @@ Overview **Commit Check** is a free, powerful tool that enforces commit metadata standards, including commit message, branch naming, committer name/email, and commit signoff. Fully customizable with error messages and suggested commands, it ensures compliance across teams. -As an alternative to GitHub Enerprise `Metadata restrictions `_ and Bitbucket's paid puglin `Yet Another Commit Checker `_, Commit Check stands out by integrating DevOps principles and Infrastructure as Code (IaC). +As an alternative to GitHub Enterprise `Metadata restrictions `_ and Bitbucket's paid puglin `Yet Another Commit Checker `_, Commit Check stands out by integrating DevOps principles and Infrastructure as Code (IaC). Configuration ------------- @@ -75,6 +75,7 @@ Running as pre-commit hook - id: check-author-name - id: check-author-email - id: check-commit-signoff + - id: check-merge-base Running as CLI ~~~~~~~~~~~~~~ @@ -107,7 +108,7 @@ To configure the hook, create a script file in the ``.git/hooks/`` directory. .. code-block:: bash #!/bin/sh - commit-check --message --branch --author-name --author-email + commit-check --message --branch --author-name --author-email --commit-signoff --merge-base Save the script file as ``pre-push`` and make it executable: From 6bba256f71b9cbf687b37408f6226d299d3fa20d Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Wed, 13 Nov 2024 11:40:01 +0000 Subject: [PATCH 2/2] feat: update pre-commit config files --- .pre-commit-config.yaml | 7 ++++--- .pre-commit-hooks.yaml | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 066e559..d65d917 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,10 +32,11 @@ repos: hooks: - id: codespell - repo: https://github.com/commit-check/commit-check - rev: v0.8.5 + rev: v0.9.1 hooks: - id: check-message # - id: check-branch # uncomment if you need. - # - id: check-author-name # uncomment if you need. - # - id: check-author-email # uncomment if you need. + - id: check-author-name # uncomment if you need. + - id: check-author-email # uncomment if you need. # - id: commit-signoff # uncomment if you need. + # - id: check-merge-base # uncomment if you need. diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index af2e2c8..1fca51a 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,6 +1,6 @@ - id: check-message name: check commit message - description: requiring commit message to match regex + description: ensures commit message to match regex entry: commit-check args: [--message] pass_filenames: true @@ -8,35 +8,35 @@ stages: [commit-msg, prepare-commit-msg] - id: check-branch name: check branch naming - description: requiring branch naming to match regex + description: ensures branch naming to match regex entry: commit-check args: [--branch] pass_filenames: false language: python - id: check-author-name name: check committer name - description: requiring committer name to match regex + description: ensures committer name to match regex entry: commit-check args: [--author-name] pass_filenames: false language: python - id: check-author-email name: check committer email - description: requiring committer email to match regex + description: ensures committer email to match regex entry: commit-check args: [--author-email] pass_filenames: false language: python - id: check-commit-signoff name: check committer signoff - description: requiring committer to add a Signed-off-by trailer + description: ensures committer to add a Signed-off-by trailer entry: commit-check args: [--commit-signoff] pass_filenames: false language: python - id: check-merge-base name: check merge base - description: requiring to rebase current branch onto target branch + description: ensures current branch is rebased onto target branch entry: commit-check args: [--merge-base] pass_filenames: false