ci(lint): forbid misleading type+scope combinations in commit messages#2799
Conversation
PR Summary by QodoEnforce gitlint UC1 to block misleading feat/fix scopes for ci/e2e
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Site previewPreview: https://1646afc9-site.fullsend-ai.workers.dev Commit: |
|
🤖 Finished Review · ✅ Success · Started 7:43 PM UTC · Completed 8:06 PM UTC |
Code Review by Qodo
1.
|
| # Pattern: type(scope): description | ||
| _CONVENTIONAL = re.compile(r"^(?P<type>\w+)\((?P<scope>[^)]+)\)") | ||
|
|
There was a problem hiding this comment.
2. Regex misses colon delimiter 🐞 Bug ≡ Correctness
ForbiddenTypeScope’s regex matches type(scope) without requiring the documented : delimiter, so UC1 can emit its “pollutes release notes” message on malformed/non-conventional titles that happen to start with fix(ci)/feat(ci) etc.
Agent Prompt
### Issue description
`_CONVENTIONAL` is documented as matching `type(scope): description`, but the actual regex only matches `type(scope)` and does not require `:` (or whitespace after it). This can cause UC1 to run (and emit a misleading message) even when the title does not follow the documented Conventional Commits format.
### Issue Context
The repo’s commit format documentation explicitly requires `:<space>` after the scope.
### Fix Focus Areas
- gitlint_rules/forbidden_type_scope.py[13-15]
- COMMITS.md[5-13]
- gitlint_rules_test.py[26-40]
### Suggested fix
Update the regex to require the delimiter, and optionally support breaking markers:
- e.g. `re.compile(r"^(?P<type>\w+)\((?P<scope>[^)]+)\)!?:\s")`
Add a test case demonstrating that malformed titles (e.g. `fix(ci) update workflow` without `:`) do not trigger UC1.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
ReviewFindingsHigh
Labels: PR adds gitlint commit-message linting rules and modifies the CI lint workflow. Previous runReviewFindingsMedium
|
dbc2516 to
f45f60e
Compare
Add a custom gitlint rule (UC1) that rejects feat(ci), fix(ci), feat(e2e), and fix(e2e). These combinations pollute user-facing release notes with infrastructure changes that mean nothing to end users. The rule provides actionable error messages pointing to the correct prefix, e.g. "Use ci(<subsystem>)" or "Use ci(e2e)". Signed-off-by: rbean <rbean@redhat.com> Assisted-by: Claude claude-opus-4-6 <noreply@anthropic.com> Signed-off-by: Ralph Bean <rbean@redhat.com>
Assisted-by: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Ralph Bean <rbean@redhat.com>
f45f60e to
4ac4b12
Compare
|
🤖 Review · |
The gitlint_rules_test.py added in the previous commit imports pytest and gitlint.rules, but the CI workflow only installed pre-commit and jsonschema. Add both packages to the uv pip install step. Assisted-by: Claude claude-opus-4-6 <noreply@anthropic.com> Signed-off-by: Ralph Bean <rbean@redhat.com>
d4c4954 to
72aa637
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
🤖 Review · ❌ Terminated · Started 6:58 PM UTC · Ended 7:10 PM UTC |
|
|
||
| - name: Install pre-commit and test dependencies | ||
| run: uv pip install --system pre-commit jsonschema | ||
| run: uv pip install --system pre-commit jsonschema pytest gitlint-core |
There was a problem hiding this comment.
[high] protected-path
This PR modifies .github/workflows/lint.yml, which is under the .github/ protected path. The PR has no linked issue providing authorization for modifying governance/infrastructure files. Human approval is always required for protected-path changes.
Suggested fix: File an issue documenting the need to add pytest and gitlint-core to the CI lint workflow, and link it to this PR.
|
🤖 Finished Review · ✅ Success · Started 6:58 PM UTC · Completed 7:10 PM UTC |
waynesun09
left a comment
There was a problem hiding this comment.
LGTM. Simple, well-tested rule that prevents misleading release note entries. CI is green. Bot findings are all non-blocking (protected-path is procedural with existing human approval, regex colon nit is mitigated by CT1 running first).
|
🤖 Finished Retro · ✅ Success · Started 8:51 PM UTC · Completed 8:58 PM UTC |
Retro: PR #2799 —
|
Summary
UC1) that rejectsfeat(ci),fix(ci),feat(e2e), andfix(e2e)with actionable error messages suggesting the correct prefixThese type+scope combos put infrastructure noise in user-facing release notes under Features or Bug Fixes — confusing for users deciding whether to upgrade.
Test plan
python3 -m pytest gitlint_rules_test.py -v— 18/18 passmake script-test— all pass including the new testecho "fix(ci): foo" | gitlint --config .gitlint --ignore B6 --msg-filename /dev/stdinexits non-zero with clear messageci(e2e):,chore(ci):,fix(mint):still pass🤖 Generated with Claude Code