From 265c891e1972d75db6b6c378021912ae759820df Mon Sep 17 00:00:00 2001 From: csh Date: Mon, 13 Jul 2026 11:22:50 +0800 Subject: [PATCH] :bug: fix(ci): allow kebab-case commit scopes The scope regex only accepted [a-z0-9_], rejecting hyphenated scopes like tsl-syntax that dominate the history (12x vs 4x underscore form). Align both linter copies and the spec doc to accept lower-kebab-case. Co-Authored-By: Claude Fable 5 --- .gitea/ci/commit_message_lint.py | 2 +- docs/common/commit_message.md | 2 +- templates/ci/gitea/.gitea/ci/commit_message_lint.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitea/ci/commit_message_lint.py b/.gitea/ci/commit_message_lint.py index 554461f4..6baa5386 100644 --- a/.gitea/ci/commit_message_lint.py +++ b/.gitea/ci/commit_message_lint.py @@ -78,7 +78,7 @@ def _validate_subject_line( m = re.match( r"^(?:(?P:[a-z0-9_+-]+:)\s+)?" r"(?P[a-z]+)" - r"(?P\([a-z0-9_]+\))?" + r"(?P\([a-z0-9_-]+\))?" r":\s+(?P.+)$", subject, ) diff --git a/docs/common/commit_message.md b/docs/common/commit_message.md index 47d04926..c4784d2e 100644 --- a/docs/common/commit_message.md +++ b/docs/common/commit_message.md @@ -23,7 +23,7 @@ footer - `emoji`:可选,位于首行行首;若使用,必须与 `type` 一一对应(见 4)。为保持一致性,建议默认使用 emoji;若不使用则省略即可。 - `type`:变更类型,必须从 4 的对应表中选取。 -- `scope`:可选,业务域/组件名(`lower_snake_case`),用于辅助定位影响范围。 +- `scope`:可选,业务域/组件名(`lower-kebab-case` 或 `lower_snake_case`),用于辅助定位影响范围。 - `subject`:一句话概述,使用祈使句/现在时,首字母小写,不加句号。 - `body`:可选,说明动机、关键实现、影响面;每行建议 ≤ 72 字符。 - `footer`:可选,关联任务/缺陷号,或 `BREAKING CHANGE:` 说明不兼容变更。 diff --git a/templates/ci/gitea/.gitea/ci/commit_message_lint.py b/templates/ci/gitea/.gitea/ci/commit_message_lint.py index 554461f4..6baa5386 100644 --- a/templates/ci/gitea/.gitea/ci/commit_message_lint.py +++ b/templates/ci/gitea/.gitea/ci/commit_message_lint.py @@ -78,7 +78,7 @@ def _validate_subject_line( m = re.match( r"^(?:(?P:[a-z0-9_+-]+:)\s+)?" r"(?P[a-z]+)" - r"(?P\([a-z0-9_]+\))?" + r"(?P\([a-z0-9_-]+\))?" r":\s+(?P.+)$", subject, )