Skip to content

Commit c121fdf

Browse files
author
cradu
committed
Updated chunk size to be configurable per command if needed
1 parent ec2ccf2 commit c121fdf

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Console/Commands/Hooks/BaseCodeAnalyzerPreCommitHook.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,16 @@ abstract class BaseCodeAnalyzerPreCommitHook implements CodeAnalyzerPreCommitHoo
6767
*/
6868
protected string $dockerContainer = '';
6969

70+
/**
71+
* @var Chunk size used for analyze
72+
*/
73+
protected int $chunkSize = 100;
74+
7075
public function __construct()
7176
{
7277
$this->setCwd(base_path());
78+
79+
$this->chunkSize = config('git-hooks.analyzer_chunk_size');
7380
}
7481

7582
/**
@@ -191,10 +198,8 @@ public function getDockerContainer(): string
191198
*/
192199
protected function analizeCommittedFiles(Collection $commitFiles): self
193200
{
194-
$chunkSize = config('git-hooks.analyzer_chunk_size');
195-
196201
/** @var Collection<int, ChangedFile> $chunk */
197-
foreach ($commitFiles->chunk($chunkSize) as $chunk) {
202+
foreach ($commitFiles->chunk($this->chunkSize) as $chunk) {
198203
$filePaths = [];
199204

200205
/** @var ChangedFile $file */

0 commit comments

Comments
 (0)