Skip to content

Commit

Permalink
Updated chunk size to be configurable per command if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
cradu committed Aug 27, 2024
1 parent ec2ccf2 commit c121fdf
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Console/Commands/Hooks/BaseCodeAnalyzerPreCommitHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,16 @@ abstract class BaseCodeAnalyzerPreCommitHook implements CodeAnalyzerPreCommitHoo
*/
protected string $dockerContainer = '';

/**
* @var Chunk size used for analyze
*/
protected int $chunkSize = 100;

public function __construct()
{
$this->setCwd(base_path());

$this->chunkSize = config('git-hooks.analyzer_chunk_size');
}

/**
Expand Down Expand Up @@ -191,10 +198,8 @@ public function getDockerContainer(): string
*/
protected function analizeCommittedFiles(Collection $commitFiles): self
{
$chunkSize = config('git-hooks.analyzer_chunk_size');

/** @var Collection<int, ChangedFile> $chunk */
foreach ($commitFiles->chunk($chunkSize) as $chunk) {
foreach ($commitFiles->chunk($this->chunkSize) as $chunk) {
$filePaths = [];

/** @var ChangedFile $file */
Expand Down

0 comments on commit c121fdf

Please sign in to comment.