-
Notifications
You must be signed in to change notification settings - Fork 34
feat: added commit message linting #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds commit-message enforcement and automation: Commitlint config, Husky hooks (pre-commit and commit-msg), Commitizen/lint-staged tooling in package.json, a GitHub Actions workflow to lint commits on PRs, and README setup instructions. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant Git as Local Git
participant Husky as Husky Hooks
participant LS as lint-staged
participant CL as Commitlint
Dev->>Git: git commit
Git->>Husky: pre-commit
Husky->>LS: npx lint-staged
LS-->>Husky: results
alt staged checks pass
Husky-->>Git: continue
Git->>Husky: commit-msg
Husky->>CL: npx commitlint --edit $1
CL-->>Husky: pass/fail
alt valid
Husky-->>Git: allow commit
else invalid
Husky-->>Dev: block commit with errors
end
else staged checks fail
Husky-->>Dev: block commit
end
sequenceDiagram
autonumber
participant GH as GitHub
participant WF as Workflow: Commit Compliance
participant Repo as Repository
participant Node as Node 18
participant CL as Commitlint
GH-->>WF: PR opened/synchronize/reopened
WF->>Repo: actions/checkout (fetch-depth: 0, include submodules, PR head)
WF->>Node: setup-node@v4 (Node 18)
WF->>Repo: npm ci --legacy-peer-deps
WF->>CL: commitlint --from ${{base}} --to ${{head}} --verbose
CL-->>WF: pass/fail
WF-->>GH: report status on PR
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (2)
README.md (1)
69-96: Add languages to fenced code blocksMarkdown lint (MD040) is flagging the unlabeled fences here. Tagging them as
bash/shellkeeps docs clean and silences CI. Example:- ``` + ```bash node --version npm --version ```Please do the same for the other new blocks in this section.
.github/workflows/commit-lint.yml (1)
25-30: Optional: Cache npm dependencies to speed up this jobLine 25 currently re-installs everything on each run. Adding
cache: 'npm'to theactions/setup-nodestep would reuse the cache between runs and keep this workflow snappy.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (6)
.github/workflows/commit-lint.yml(1 hunks).husky/commit-msg(1 hunks).husky/pre-commit(1 hunks)README.md(1 hunks)commitlint.config.js(1 hunks)package.json(1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
README.md
68-68: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
74-74: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🔇 Additional comments (1)
commitlint.config.js (1)
22-33: Commit type whitelist matches the conventional setLine 22 onward covers the standard Conventional Commit types, so the enforcement looks solid.
|



📋 Description
JIRA ID:
GitHub Issue: Fixes PSMRI/AMRIT#85
This PR introduces commit message standardization for the
HWC-UIproject by setting up Commitlint, Husky, and Commitizen. This PR enforce a consistent commit message format across the repository to improve collaboration, readability, and enable automation (like changelogs and versioning) in the future.These tools are now fully integrated:
✅ Type of Change
ℹ️ Additional Information
Changes Overview
commitlint.config.jswith conventional commit rules..husky/commit-msg.Commitizenwith configuration inpackage.jsonfor interactive commit prompts..github/workflows/commit-lint.ymlto check commit messages on PRs.package.jsonandpackage-lock.jsonwith required dev dependencies:@commitlint/cli@commitlint/config-conventionalcommitizencz-conventional-changelogTesting & Validation
npm run commitornpx cz.Screenshots
Summary by CodeRabbit
Chores
Documentation