Skip to content

chore(commitlint): add commit-msg hook and workflow validation#137

Open
DurgaPrasad-54 wants to merge 2 commits intoPSMRI:mainfrom
DurgaPrasad-54:feat/commitlint-setup
Open

chore(commitlint): add commit-msg hook and workflow validation#137
DurgaPrasad-54 wants to merge 2 commits intoPSMRI:mainfrom
DurgaPrasad-54:feat/commitlint-setup

Conversation

@DurgaPrasad-54
Copy link
Contributor

@DurgaPrasad-54 DurgaPrasad-54 commented Mar 6, 2026

📋 Description

JIRA ID:

Add the commit message validation setup by defining the commit rules directly in commitlint.config.js instead of extending @commitlint/config-conventional.


✅ Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)
  • New feature (non-breaking change which adds functionality)
  • 🔥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🛠 Refactor (change that is neither a fix nor a new feature)
  • ⚙️ Config change (configuration file or build script updates)
  • 📚 Documentation (updates to docs or readme)
  • 🧪 Tests (adding new or updating existing tests)
  • 🎨 UI/UX (changes that affect the user interface)
  • 🚀 Performance (improves performance)
  • 🧹 Chore (miscellaneous changes that don't modify src or test files)

Summary by CodeRabbit

Release Notes

  • Documentation

    • Simplified initial setup process—git hooks now require a single command after cloning
    • Added community section with Discord invitation for user engagement
  • Chores

    • Updated commit validation workflow and configuration

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 6, 2026

📝 Walkthrough

Walkthrough

This pull request migrates git hook management from Husky to a native .git-hooks directory approach. The changes consolidate commit message validation using commitlint, remove npm dependencies (husky, commitizen, lint-staged), update CI/CD workflows for per-commit validation, and simplify developer setup documentation.

Changes

Cohort / File(s) Summary
Git Hooks Migration
.git-hooks/commit-msg, .husky/commit-msg, .husky/pre-commit
Moves commit message validation from Husky hooks to native git hooks using .git-hooks/commit-msg script; removes the old Husky hook files and pre-commit lint-staged integration.
CI/CD Workflow Updates
.github/workflows/commit-lint.yml
Refactors commit linting from single run to per-commit validation loop, updates Node.js from version 18 to 20, simplifies checkout configuration, and removes npm install step.
Commitlint Configuration
commitlint.config.js
Removes extends property referencing conventional config, adds explicit rule definitions for subject-empty, subject-full-stop, type-case, type-empty, and type-enum within the rules object.
Documentation & Dependencies
README.md, package.json
Simplifies setup instructions to single git hooks configuration command, removes detailed environment setup guidance, adds community Discord section; deletes entire package.json removing dev tooling dependencies (husky, commitizen, cz-conventional-changelog, lint-staged).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hooks in the shadows, no packages to weigh,
Native git paths now show us the way,
Commitlint rules dance, clean and concise,
Simpler setups—oh what a device!
Carrots of code, now lighter to carry,
Our tools are refined, no need to worry! 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: adding a commit-msg hook and workflow validation for commitlint configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/commit-lint.yml (1)

1-8: Update branch protection to the new check name.

The required status will change from the old commitlint job to commit-check. If repository rules still require the previous check name, this workflow can succeed in Actions without actually gating merges until the required check is updated.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/commit-lint.yml around lines 1 - 8, Branch protection
still expects the old check name "commitlint" so update required status checks
to the new job name "commit-check"; locate the workflow job named commit-check
and then update your repository branch protection rules (or any
required_status_checks contexts in repo settings or automation scripts) to
include "commit-check" and remove "commitlint", and also search for any other
references (docs/scripts) that mention "commitlint" to keep names consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.git-hooks/commit-msg:
- Line 4: The commit hook currently invokes npx to fetch `@commitlint/cli` at
commit time which breaks offline; instead add `@commitlint/cli` as a devDependency
(or include it in your repo setup script) and update the commit-msg hook to call
the local binary (e.g., the installed commitlint CLI in node_modules/.bin or an
npm script like "commitlint") rather than using npx so commits do not trigger a
live npm install; reference `@commitlint/cli` and the commit-msg hook when making
the changes.

In `@README.md`:
- Around line 37-38: Update the README prerequisite that currently reads
"Node.js (v14 or later)" to "Node.js (v18 or later)" so it matches the
`@commitlint/cli`@20.4.3 requirement; search for the "Node.js (v14 or later)" text
in README.md and replace it with "Node.js (v18 or later)" and ensure any
adjacent compatibility notes (e.g., under prerequisites or setup) reflect this
updated minimum Node version.

---

Nitpick comments:
In @.github/workflows/commit-lint.yml:
- Around line 1-8: Branch protection still expects the old check name
"commitlint" so update required status checks to the new job name
"commit-check"; locate the workflow job named commit-check and then update your
repository branch protection rules (or any required_status_checks contexts in
repo settings or automation scripts) to include "commit-check" and remove
"commitlint", and also search for any other references (docs/scripts) that
mention "commitlint" to keep names consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d76747ee-4b82-4afd-9dfa-8c9bb4177b8d

📥 Commits

Reviewing files that changed from the base of the PR and between 7dee6de and e07ae4b.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • .git-hooks/commit-msg
  • .github/workflows/commit-lint.yml
  • .husky/commit-msg
  • .husky/pre-commit
  • README.md
  • commitlint.config.js
  • package.json
💤 Files with no reviewable changes (3)
  • .husky/pre-commit
  • .husky/commit-msg
  • package.json

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 6, 2026

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