Configured pre-commit hook same as pre-push hook

Currently, our project utilizes a pre-push hook to catch potential issues before they are pushed to the remote repository. While this is a valuable step in our development workflow, it would be even more efficient to identify and address problems at an earlier stage

Issue fork api_client-3386860

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pratik_kamble created an issue. See original summary.

pratik_kamble’s picture

Title: Configured pre-commit hook same as pre-push hook » Configure pre-commit hook same as pre-push hook

pratik_kamble’s picture

Assigned: pratik_kamble » Unassigned
Status: Active » Needs review
shrutishende’s picture

Assigned: Unassigned » shrutishende
shrutishende’s picture

  1. I ran the pnpm prepare command to set up Git hooks using Husky.
  2. I made a deliberate formatting error in the examples/json-api-client/src/main.ts file.
  3. When I attempted to commit my changes using the git commit command, I encountered a linting error.
  4. I also verified that all the commands within the pre-commit hooks were executed as expected.
shrutishende’s picture

Assigned: shrutishende » Unassigned
Status: Needs review » Reviewed & tested by the community

brianperry made their first commit to this issue’s fork.

brianperry’s picture

On past projects heard some feedback about the commit hooks being a barrier for folks, but we talked things over in Slack and the consensus was to add them. We can always revisit this if it is a problem for people.

Thanks @pratik_kamble and @shrutishende

brianperry’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.