In this episode of the Laravel Creator Spotlight, we are joined by Len Woodward, the creator of Whisky, to talk about the project.
Whisky Introduction
Whisky is the simplest, framework agnostic, CLI tool for managing and enforcing a php project’s git hooks across an entire team.
Git hooks are a fantastic tool to ensure that code hitting version control satisfies your org’s code quality standards. However, .git/hooks is not included in your git tree. This makes it impractical to have all contributors to a repository use the same checks with the same settings.
Whisky Installation
Whisky’s only dependency is php^8.1.
You can install the package via composer:
composer require –dev projektgopher/whisky
./vendor/bin/whisky install
This is the recommended method, as every developer on your project will have access to the tool.
Global Installation
Whisky can be installed globally, however this means that any developer on your project will also need it installed globally if they want to use it.
composer global require projektgopher/whisky
whisky install
If Whisky is installed both globally, and locally, on a project the version that’s run will depend on how the command is invoked.
Whisky Usage
The install command will create a whisky.json file in your project root:
// whisky.json
{
“disabled”: [],
“hooks”: {
“pre-commit”: [
“./vendor/bin/pint –dirty”
],
“pre-push”: [
“php artisan test”
]
}
}
Warning all hooks are evaluated as-is in the terminal. Keep this in mind when committing anything involving changes to your whisky.json.
Adding or removing any hooks (not individual commands) to your whisky.json file should be followed by ./vendor/bin/whisky update to ensure that these changes are reflected in your .git/hooks directory.
Show Links:
You can watch the interview on the Laravel News Youtube channel here or listen in your podcast app of choice.
<iframe width=”100%” height=”180″ frameborder=”no” scrolling=”no” seamless=”” src=”https://share.transistor.fm/e/109a2cab”></iframe>
The post Git Hooks Made Easy: How Whisky Helps Developers with Len Woodward appeared first on Laravel News.
Join the Laravel Newsletter to get all the latest
Laravel articles like this directly in your inbox.
Source: Read MoreÂ