Skip to content

Commit 92aea16

Browse files
committed
README.md updated
1 parent 0f41488 commit 92aea16

File tree

2 files changed

+30
-95
lines changed

2 files changed

+30
-95
lines changed

README.md

Lines changed: 24 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -71,131 +71,62 @@ To use the already created pre-commit hooks of this package, you can simply edit
7171
],
7272
```
7373

74-
By default the pre-commit hooks will stop at first failure and will not continue with the remaining tools.
74+
### 🔧 Auto-fix Capabilities
7575

76+
By default the pre-commit hooks will stop at first failure and will not continue with the remaining tools.
7677
If the tool contains a fixer option it will prompt in the CLI to run the fix command.
7778

79+
The package includes powerful auto-fix functionality that can automatically resolve code style and formatting issues:
80+
81+
- **Interactive Fixing:** By default, when an issue is detected, you'll be prompted to run the fix command
82+
- **Automatic Fixing:** Enable `automatically_fix_errors` to fix issues without prompts
83+
- **Smart Re-running:** Enable `rerun_analyzer_after_autofix` to automatically verify fixes succeeded
84+
7885
This behavior can be adjusted using the following parameters from git-hooks.php config file:
7986
```php
80-
/*
81-
|--------------------------------------------------------------------------
82-
| Automatically fix errors
83-
|--------------------------------------------------------------------------
84-
|
85-
| This configuration option allows you to configure the git hooks to
86-
| automatically run the fixer without any CLI prompt.
87-
|
88-
*/
87+
// config/git-hooks.php
8988
'automatically_fix_errors' => false,
90-
91-
/*
92-
|--------------------------------------------------------------------------
93-
| Automatically re-run analyzer after autofix
94-
|--------------------------------------------------------------------------
95-
|
96-
| This configuration option allows you to configure the git hooks to
97-
| automatically re-run the analyzer command after autofix.
98-
| The git hooks will not fail in case the re-run is succesful.
99-
|
100-
*/
10189
'rerun_analyzer_after_autofix' => false,
102-
103-
/*
104-
|--------------------------------------------------------------------------
105-
| Stop at first analyzer failure
106-
|--------------------------------------------------------------------------
107-
|
108-
| This configuration option allows you to configure the git hooks to
109-
| stop (or not) at the first analyzer failure encountered.
110-
|
111-
*/
11290
'stop_at_first_analyzer_failure' => true,
11391
```
11492

115-
There are also several debug options which can be adjusted using the following parameters from git-hooks.php config file:
93+
## 3️⃣ Advanced Usage
11694

117-
```php
118-
/*
119-
|--------------------------------------------------------------------------
120-
| Output errors
121-
|--------------------------------------------------------------------------
122-
|
123-
| This configuration option allows you output any errors encountered
124-
| during execution directly for easy debug.
125-
|
126-
*/
127-
'output_errors' => false,
128-
129-
/*
130-
|--------------------------------------------------------------------------
131-
| Debug commands
132-
|--------------------------------------------------------------------------
133-
|
134-
| This configuration option allows you to configure the git hooks to
135-
| display the commands that are executed (usually for debug purpose).
136-
|
137-
*/
138-
'debug_commands' => false,
139-
140-
/*
141-
|--------------------------------------------------------------------------
142-
| Debug output
143-
|--------------------------------------------------------------------------
144-
|
145-
| This configuration option allows you display the output of each
146-
| command during execution directly for easy debug.
147-
|
148-
*/
149-
'debug_output' => false,
150-
```
151-
### Laravel Sail support
95+
### 🐳 Laravel Sail support
15296

15397
If you are using Laravel Sail and maybe not lokal PHP is installed, you can adjust the following parameters in the git-hooks.php config file:
15498

15599
```php
100+
// config/git-hooks.php
156101
'use_sail' => env('GITHOOKS_USE_SAIL', false),
157102
```
158103
This will force the local git hooks to use the `sail` command to execute the hooks.
159104

160-
### Docker support
105+
### 🐳 Docker support
161106

162107
By default commands are executed locally, however this behavior can be adjusted for each hook using the parameters `run_in_docker` and `docker_container`:
163108

164109
```php
110+
// config/git-hooks.php
165111
'run_in_docker' => env('LARAVEL_PINT_RUN_IN_DOCKER', true),
166112
'docker_container' => env('LARAVEL_PINT_DOCKER_CONTAINER', 'app'),
167113
```
168114

169-
### Advanced Configuration Options
115+
### 🔧🪲 Advanced Configuration Options & Debug Mode
170116

171-
The package provides additional configuration options for fine-tuning hook behavior:
117+
The git-hooks.php config file offers several debug options that can be adjusted using the following parameters.
118+
It also provides additional configuration options for fine-tuning hook behavior.
172119

173120
```php
174-
/*
175-
|--------------------------------------------------------------------------
176-
| Validate paths
177-
|--------------------------------------------------------------------------
178-
|
179-
| This configuration option allows you to validate paths before executing
180-
| hooks, ensuring that files exist before attempting to process them.
181-
|
182-
*/
121+
// config/git-hooks.php
122+
'output_errors' => false,
123+
'debug_commands' => false,
124+
'debug_output' => false,
183125
'validate_paths' => env('GITHOOKS_VALIDATE_PATHS', true),
184-
185-
/*
186-
|--------------------------------------------------------------------------
187-
| Analyzer chunk size
188-
|--------------------------------------------------------------------------
189-
|
190-
| This configuration option allows you to configure the chunk size for
191-
| processing files in batches. This can improve performance for repositories
192-
| with many files.
193-
|
194-
*/
195126
'analyzer_chunk_size' => env('GITHOOKS_ANALYZER_CHUNK_SIZE', 100),
196127
```
197128

198-
### Creating Custom Git Hooks
129+
### 🛠️ Creating Custom Git Hooks
199130
1) If you need to create a custom Git hook for your project, Laravel Git Hooks makes it easy with the `git-hooks:make` Artisan command. To create a new custom hook, simply run the following command:
200131
```bash
201132
php artisan git-hooks:make
@@ -214,7 +145,7 @@ The package provides additional configuration options for fine-tuning hook behav
214145
php artisan git-hooks:register
215146
```
216147
217-
## 3️⃣ Handling Git Hooks
148+
## 4️⃣ Handling Git Hooks
218149
### Pre-commit Hook
219150
> The pre-commit hook is run first, before you even type in a commit message. It's used to inspect the snapshot that's
220151
> about to be committed, to see if you've forgotten something, to make sure tests run, or to examine whatever you need to
@@ -391,7 +322,7 @@ return [
391322
392323
The class structure of the `pre-push` hooks is the same as the `post-commit` hook shown right above, but implementing `\Igorsgm\GitHooks\Contracts\PrePushHook` interface.
393324
394-
## Testing
325+
## 🧪 Testing
395326
396327
``` bash
397328
composer test

config/git-hooks.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@
280280
| Validate paths
281281
|--------------------------------------------------------------------------
282282
|
283-
| This configuration option allows you enable (or not) validation
283+
| This configuration option allows you to enable (or not) validation
284284
| of paths. This can be useful when binary files are not part of the
285285
| project directly.
286286
|
@@ -306,6 +306,8 @@
306306
|
307307
| This configuration option allows you to configure the git hooks to
308308
| automatically run the fixer without any CLI prompt.
309+
| When enabled, fixable issues (code style, formatting) will be
310+
| automatically resolved during the pre-commit process.
309311
|
310312
*/
311313
'automatically_fix_errors' => env('GITHOOKS_AUTOMATICALLY_FIX_ERRORS', false),
@@ -317,7 +319,8 @@
317319
|
318320
| This configuration option allows you to configure the git hooks to
319321
| automatically re-run the analyzer command after autofix.
320-
| The git hooks will not fail in case the re-run is succesful.
322+
| The git hooks will not fail in case the re-run is successful.
323+
| This ensures that auto-fixed code passes all quality checks.
321324
|
322325
*/
323326
'rerun_analyzer_after_autofix' => env('GITHOOKS_RERUN_ANALYZER_AFTER_AUTOFIX', false),
@@ -329,6 +332,7 @@
329332
|
330333
| This configuration option allows you to configure the git hooks to
331334
| stop (or not) at the first analyzer failure encountered.
335+
| Set to false to run all configured hooks even if some fail.
332336
|
333337
*/
334338
'stop_at_first_analyzer_failure' => env('GITHOOKS_STOP_AT_FIRST_ANALYZER_FAILURE', true),

0 commit comments

Comments
 (0)