Skip to content

chore: commit hook enforcing semver commit message prefixes#139

Merged
nabalone merged 1 commit intomainfrom
semver_commit_hook
Mar 3, 2026
Merged

chore: commit hook enforcing semver commit message prefixes#139
nabalone merged 1 commit intomainfrom
semver_commit_hook

Conversation

@nabalone
Copy link
Collaborator

@nabalone nabalone commented Mar 2, 2026


Open with Devin

This change is Reviewable

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

Comment on lines +86 to +90
Accepted prefixes are:

"volta": {
"extends": "../../../../package.json"
}
- `feat:` to trigger a minor version bump
- `fix:` to trigger a patch version bump
- `chore:` for a commit that doesn't trigger a release/version bump

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: README documents only feat/fix/chore but the regex also allows scope and breaking change markers

The README at lines 87-90 lists accepted prefixes as feat:, fix:, and chore:, but does not mention that the validator also accepts optional scopes like feat(api): and breaking change indicators like feat!: or feat(api)!:. The examples in the error message of the validation script (lines 31-35) do document these, so users will see them upon failure, but it might be helpful to mention them in the README as well for discoverability.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +20 to +22
if (/^(Merge|Revert|fixup!|squash!)/.test(firstLine)) {
process.exit(0);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: Bypass regex matches prefixes loosely, could skip validation for non-standard messages

The bypass regex /^(Merge|Revert|fixup!|squash!)/ at line 20 has no word boundary or trailing character requirement for Merge and Revert. This means a commit message like Reverted the feature flag or Merged two modules would bypass validation entirely, even though these are user-authored messages (not git-generated). Git's actual auto-generated messages are Revert "..." and Merge branch/pull request .... Adding a stricter pattern like ^(Merge |Revert "|fixup! |squash! ) would be more precise. This is unlikely to cause real issues in practice but is worth noting.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@nabalone nabalone force-pushed the semver_commit_hook branch from 1516e64 to bca1f8b Compare March 3, 2026 00:10
@nabalone nabalone merged commit 3d9bf69 into main Mar 3, 2026
2 checks passed
@nabalone nabalone deleted the semver_commit_hook branch March 3, 2026 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant