-
Notifications
You must be signed in to change notification settings - Fork 29
feat: added commit message linting to Inventory API #102
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 tooling and enforcement: commitlint config, Husky hooks (pre-commit, commit-msg), Commitizen and lint-staged config in package.json, a GitHub Actions workflow to lint PR commit ranges, README guidance, and .gitignore update to exclude Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant CZ as Commitizen
participant Git as Git
participant Husky as Husky
participant LS as lint-staged
participant CL as Commitlint
participant GHA as GitHub Actions
Dev->>CZ: (optional) npm run commit — guided message
Dev->>Git: git commit
activate Husky
Husky->>LS: pre-commit -> run lint-staged
LS-->>Husky: fixes/results
Husky->>CL: commit-msg -> validate message (edit file)
CL-->>Husky: pass/fail
alt pass
Husky-->>Git: allow commit
else fail
Husky-->>Dev: block commit with errors
end
deactivate Husky
Dev->>GHA: open/update PR
GHA->>CL: run commitlint on PR range (base..head)
CL-->>GHA: pass/fail
GHA-->>Dev: PR check status
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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: 6
🧹 Nitpick comments (1)
README.md (1)
47-50: Add languages to fenced code blocks (markdownlint MD040)Specify bash for shell snippets.
Apply this diff:
- ``` + ```bash node --version npm --version ``` @@ - ``` + ```bash npm ciAlso applies to: 54-55
📜 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 (7)
.github/workflows/commit-lint.yml(1 hunks).gitignore(1 hunks).husky/commit-msg(1 hunks).husky/pre-commit(1 hunks)README.md(1 hunks)commit-lint.config.js(1 hunks)package.json(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-04-25T14:46:10.894Z
Learnt from: G4URAV001
PR: PSMRI/Inventory-API#75
File: .husky/commit-msg:1-1
Timestamp: 2025-04-25T14:46:10.894Z
Learning: For Husky v9.1.1+ hooks, the shebang line (#!/usr/bin/env sh) and sourcing of Husky's helper script (. "$(dirname -- "$0")/_/husky.sh") are deprecated and will fail in v10.0.0. Hook scripts should only contain the command to be executed without these header lines.
Applied to files:
.husky/pre-commit.husky/commit-msg
📚 Learning: 2025-04-25T14:46:25.965Z
Learnt from: G4URAV001
PR: PSMRI/Inventory-API#75
File: package.json:6-6
Timestamp: 2025-04-25T14:46:25.965Z
Learning: For Husky v9+, the correct prepare script is "prepare": "husky" (not "husky install" which was used in v8 and earlier). This change was introduced in Husky v9 which simplified the setup process. Reference: https://typicode.github.io/husky/how-to.html
Applied to files:
.husky/pre-commit
🪛 markdownlint-cli2 (0.18.1)
README.md
47-47: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
53-53: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🔇 Additional comments (2)
.gitignore (1)
4-5: LGTM: add node_modules to ignoreAppropriate for the newly added Node-based tooling.
package.json (1)
6-7: Husky prepare script looks correct for v9"prepare": "husky" is the right setup for Husky v9+.
Please confirm husky@^9 is indeed installed (it is in devDependencies).
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: 0
🧹 Nitpick comments (1)
README.md (1)
47-55: Add fenced code languages for CLI snippets.Markdownlint is flagging these code fences (MD040). Specify the shell language so local linting stays green.
- ``` + ```bash node --version npm --version ``` @@ - ``` + ```bash npm ci ```
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
README.md(1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
README.md
47-47: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
53-53: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
abhijeetw035
left a 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.
made required changes
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.
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.
|



📋 Description
JIRA ID:
GitHub Issue: Fixes PSMRI/AMRIT#82
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