Skip to content

feat: Implement Advanced Husky Git Hooks with Secret Scanning, Changelog Enforcement

Kushal Lagichetty requested to merge ci/pipeline into develop

Summary

This MR introduces advanced Git hooks using Husky and establishes automated quality gates for security and test coverage.


Key Changes

1. Git Hooks Infrastructure (.husky/)

Pre-commit:

  • Added logic to scan for and block unresolved merge conflict markers (<<<<<<<, =======).
  • Integrated secretlint to detect and block committed credentials.
  • Retained automated formatting and project build checks.

Pre-push:

  • Changelog Enforcement: Pushes fail if source code changes are detected without a corresponding update to CHANGELOG.md.

2. Test Coverage (53% Threshold)

Added or significantly improved coverage for the following modules:

Category Modules
Hooks useGeolocation, useNetworkStrength, use-mobile
Schemas OTP, Password Login, and Signup validation
API Interceptor and auth-header logic in axiosInstance
Utils geoUtils (formatting), profileUtils (completion logic)
UI Components Button and Card base components
Pages Redirect and login logic in LoginPage

3. Tooling & Configuration

  • Added secretlint and @secretlint/secretlint-rule-preset-recommend.
  • Configured .secretlintrc.json and initialized a base CHANGELOG.md.

How to Test

  1. Verify Secrets: Attempt to commit a file with a dummy API key — the commit should be blocked.
  2. Verify Changelog: Modify any file in src/ and attempt to push without staging CHANGELOG.md — the push should fail.
  3. Verify Coverage: Run npm run test:coverage to confirm the threshold is being respected.

Checklist

  • Code follows the style guidelines of this project.
  • Self-review of code completed.
  • Code commented in hard-to-understand areas.
  • Tests added to prove fix or feature works.
  • New and existing unit tests pass locally.
  • Dependent changes merged and published in downstream modules.

Merge request reports

Loading