Skip to content

Conversation

abhijeetw035
Copy link

@abhijeetw035 abhijeetw035 commented Sep 25, 2025

📋 Description

JIRA ID:

GitHub Issue: Fixes PSMRI/AMRIT#79

This PR introduces commit message standardization for the HWC-UI project 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:

  • Commitlint enforces conventional commit message structure.
  • Husky prevents non-compliant commits by using Git hooks.
  • Commitizen provides an easy, interactive CLI for making properly formatted commits.
  • GitHub Actions validate commit messages for all pull requests.

✅ 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)

ℹ️ Additional Information

Changes Overview

  • Added commitlint.config.js with conventional commit rules.
  • Configured Husky to run Commitlint on every commit via .husky/commit-msg.
  • Set up Commitizen with configuration in package.json for interactive commit prompts.
  • Added GitHub Actions workflow .github/workflows/commit-lint.yml to check commit messages on PRs.
  • Updated package.json and package-lock.json with required dev dependencies:
    • @commitlint/cli
    • @commitlint/config-conventional
    • commitizen
    • cz-conventional-changelog

Testing & Validation

  • Invalid commit messages are blocked locally with clear lint errors.
  • Interactive commit flow works via npm run commit or npx cz.
  • GitHub Actions workflow correctly fails PRs with non-compliant commit messages.
  • No disruption to existing build or CI pipelines.

Screenshots

image

Summary by CodeRabbit

  • Chores
    • Introduced automated commit message linting using conventional commit rules.
    • Added pre-commit checks to run staged file linters before committing.
    • Set up an automated check on pull requests to validate commit messages.
    • Added development tooling and scripts to streamline committing.
    • Updated ignore settings to exclude dependency directories.
    • Added project configuration for commit and lint tooling.

Copy link
Contributor

coderabbitai bot commented Sep 25, 2025

Warning

Rate limit exceeded

@abhijeetw035 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 29 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 13e10e2 and bfcb5b8.

📒 Files selected for processing (3)
  • .github/workflows/commit-lint.yml (1 hunks)
  • README.md (1 hunks)
  • package.json (1 hunks)

Walkthrough

Adds commit message linting and automation: introduces a GitHub Actions workflow to run commitlint on PRs, Husky hooks for local commit checks and lint-staged, a commitlint configuration, a Node.js package manifest with commit tooling (Commitizen, Husky, lint-staged), and updates .gitignore to exclude node_modules.

Changes

Cohort / File(s) Summary of Changes
CI Workflow
.github/workflows/commit-lint.yml
New workflow “Commit Compliance” running commitlint on PRs; checks out repo (with submodules), sets up Node 18, installs deps, runs commitlint over PR commit range.
Git Hooks
.husky/commit-msg, .husky/pre-commit
Adds Husky hooks: commit-msg runs npx --no -- commitlint --edit "$1"; pre-commit runs npx lint-staged.
Commitlint Config
commitlint.config.js
New configuration extending @commitlint/config-conventional with detailed rules for type, subject, header/body length, casing, and punctuation.
Node Tooling Manifest
package.json
Adds project manifest with scripts (prepare, commit), Commitizen config, lint-staged patterns, and devDependencies for commitlint, commitizen, cz-conventional-changelog, husky, lint-staged.
Ignore Patterns
.gitignore
Adds node_modules to ignored entries.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer
  participant Git as Local Git
  participant Husky as Husky Hooks
  participant LintStaged as lint-staged
  participant CmtLint as commitlint

  Dev->>Git: git commit
  Git->>Husky: invoke pre-commit
  Husky->>LintStaged: run staged linters
  LintStaged-->>Husky: status (pass/fail)
  alt lint-staged passed
    Husky-->>Git: allow proceed
    Git->>Husky: invoke commit-msg
    Husky->>CmtLint: commitlint --edit "$1"
    CmtLint-->>Husky: status (pass/fail)
    alt commitlint passed
      Husky-->>Git: allow commit
      Git-->>Dev: commit created
    else commitlint failed
      Husky-->>Dev: block commit with errors
    end
  else lint-staged failed
    Husky-->>Dev: block commit with errors
  end
Loading
sequenceDiagram
  autonumber
  actor Dev as Developer
  participant GH as GitHub
  participant Runner as Actions Runner
  participant CmtLint as commitlint

  Dev->>GH: Open/Sync/Reopen PR
  GH->>Runner: Trigger "Commit Compliance"
  Runner->>Runner: Checkout repo (submodules, full history)
  Runner->>Runner: Setup Node 18, npm ci
  Runner->>CmtLint: npx commitlint --from BASE_SHA --to HEAD_SHA --verbose
  CmtLint-->>Runner: report success/fail
  Runner-->>GH: Post workflow status on PR
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Suggested reviewers

Poem

A rabbit taps: cz to compose,
Commitlint sniffs each line it knows.
Husky guards the burrow gate,
Lint-staged checks won’t hesitate.
On PR winds the actions fly—
Green carrots glow, the tests comply.
Hop! The history’s clean and spry. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The PR includes updates that fall outside the linked issue objectives, such as adding a .gitignore entry for node_modules and introducing a lint-staged pre-commit hook with related configuration, which are not mentioned in issue #79. Please remove or separate the lint-staged configuration and node_modules ignore additions into a dedicated change or update the linked issue to explicitly include these enhancements.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly describes the primary change by indicating the addition of commit message linting for the Common API and follows conventional commit style without extraneous detail, making it clear and focused on the main purpose of the PR.
Linked Issues Check ✅ Passed The pull request implements all linked issue requirements by integrating Commitlint with a configuration file and Git hooks, setting up Husky commit-msg hooks, configuring Commitizen in package.json, and adding a GitHub Actions workflow to validate commit messages on pull requests.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

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: 4

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0910a9b and 13e10e2.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • .github/workflows/commit-lint.yml (1 hunks)
  • .gitignore (1 hunks)
  • .husky/commit-msg (1 hunks)
  • .husky/pre-commit (1 hunks)
  • commitlint.config.js (1 hunks)
  • package.json (1 hunks)
🔇 Additional comments (2)
.gitignore (1)

39-41: Ignore local dependencies

Line 41 correctly keeps node_modules out of version control to support the new JS tooling.

commitlint.config.js (1)

1-36: Conventional commit rules look solid

The configuration (Line 3) cleanly extends @commitlint/config-conventional with sensible length limits and an explicit type-enum. Looks good to me.

Copy link

sonarqubecloud bot commented Oct 1, 2025

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.

[C4GT Community]: Implement Commit Message Linting and Automation for Common-API
2 participants