File tree 3 files changed +17
-4
lines changed
src/Console/Commands/Hooks
3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 254
254
*/
255
255
'artisan_path ' => base_path ('artisan ' ),
256
256
257
+ /*
258
+ |--------------------------------------------------------------------------
259
+ | Validate paths
260
+ |--------------------------------------------------------------------------
261
+ |
262
+ | This configuration option allows you enable (or not) validation
263
+ | of paths. This can be useful when binary files are not part of the
264
+ | project directly.
265
+ |
266
+ */
267
+ 'validate_paths ' => env ('GITHOOKS_VALIDATE_PATHS ' , true ),
268
+
257
269
/*
258
270
|--------------------------------------------------------------------------
259
271
| Output errors
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ public function setFileExtensions(array|string $fileExtensions): self
135
135
136
136
public function setAnalyzerExecutable (string $ executablePath , bool $ isSameAsFixer = false ): self
137
137
{
138
- $ this ->analyzerExecutable = ' ./ ' . trim ( $ executablePath, ' / ' ) ;
138
+ $ this ->analyzerExecutable = $ executablePath ;
139
139
140
140
return $ isSameAsFixer ? $ this ->setFixerExecutable ($ executablePath ) : $ this ;
141
141
}
@@ -147,7 +147,7 @@ public function getAnalyzerExecutable(): string
147
147
148
148
public function setFixerExecutable (string $ executablePath ): self
149
149
{
150
- $ this ->fixerExecutable = ' ./ ' . trim ( $ executablePath, ' / ' ) ;
150
+ $ this ->fixerExecutable = $ executablePath ;
151
151
152
152
return $ this ;
153
153
}
@@ -274,7 +274,7 @@ protected function commitFailMessage(): self
274
274
*/
275
275
protected function validateAnalyzerInstallation (): self
276
276
{
277
- if (file_exists ($ this ->analyzerExecutable )) {
277
+ if (! config ( ' git-hooks.validate_paths ' ) || file_exists ($ this ->analyzerExecutable )) {
278
278
return $ this ;
279
279
}
280
280
@@ -297,7 +297,7 @@ protected function validateAnalyzerInstallation(): self
297
297
*/
298
298
protected function validateConfigPath (string $ path ): self
299
299
{
300
- if (file_exists ($ path )) {
300
+ if (! config ( ' git-hooks.validate_paths ' ) || file_exists ($ path )) {
301
301
return $ this ;
302
302
}
303
303
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ public function defineEnvironment($app): void
52
52
'code_analyzers ' => [],
53
53
'artisan_path ' => base_path ('artisan ' ),
54
54
'output_errors ' => false ,
55
+ 'validate_paths ' => true ,
55
56
'automatically_fix_errors ' => false ,
56
57
'rerun_analyzer_after_autofix ' => false ,
57
58
'stop_at_first_analyzer_failure ' => true ,
You can’t perform that action at this time.
0 commit comments