Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable default ignore for dot/vcs files for single files #663

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Infrastructure/Repositories/LocalFilesRepository.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

Check failure on line 1 in src/Infrastructure/Repositories/LocalFilesRepository.php

View workflow job for this annotation

GitHub Actions / 7.4 - prefer-stable

* [Having `classes` with more than 5 cyclomatic complexity is prohibited - Consider refactoring] 12 cyclomatic complexity

declare(strict_types=1);

Expand All @@ -25,7 +25,7 @@
private ?array $files = null;

/**
* @var array<mixed>

Check failure on line 28 in src/Infrastructure/Repositories/LocalFilesRepository.php

View workflow job for this annotation

GitHub Actions / 7.4 - prefer-stable

* [Disallow mixed type hint] Usage of "mixed" type hint is disallowed.
*/
private ?array $fileList = null;

Expand All @@ -44,7 +44,7 @@
return (string) getcwd();
}

public function getFiles(): array

Check failure on line 47 in src/Infrastructure/Repositories/LocalFilesRepository.php

View workflow job for this annotation

GitHub Actions / 7.4 - prefer-stable

* [Return type hint] Method \NunoMaduro\PhpInsights\Infrastructure\Repositories\LocalFilesRepository::getFiles() does not have @return annotation for its traversable return value.
{
if ($this->files === null) {
$this->files = $this->getFilesList();
Expand All @@ -53,7 +53,7 @@
return $this->files;
}

public function within(array $paths, array $exclude = []): FilesRepository

Check failure on line 56 in src/Infrastructure/Repositories/LocalFilesRepository.php

View workflow job for this annotation

GitHub Actions / 7.4 - prefer-stable

* [Parameter type hint] Method \NunoMaduro\PhpInsights\Infrastructure\Repositories\LocalFilesRepository::within() does not have @param annotation for its traversable parameter $exclude. * [Parameter type hint] Method \NunoMaduro\PhpInsights\Infrastructure\Repositories\LocalFilesRepository::within() does not have @param annotation for its traversable parameter $paths.
{
foreach ($paths as $path) {
$pathInfo = pathinfo($path);
Expand All @@ -63,7 +63,7 @@
$this->fileList['basename'][] = $pathInfo['basename'];
$this->fileList['full_path'][] = $pathInfo['dirname'] . DIRECTORY_SEPARATOR . $pathInfo['basename'];
} else {
$this->directoryList[] = rtrim($pathInfo['dirname'], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $pathInfo['basename'];

Check failure on line 66 in src/Infrastructure/Repositories/LocalFilesRepository.php

View workflow job for this annotation

GitHub Actions / 7.4 - prefer-stable

* [Line length] Line exceeds maximum limit of 120 characters; contains 136 characters
}
}

Expand Down Expand Up @@ -108,6 +108,8 @@
$this->finder = Finder::create()
->in($this->fileList['dirname'] ?? [])
->name($this->fileList['basename'] ?? '')
->ignoreDotFiles(false)
->ignoreVCS(false)
->filter(fn (SplFileInfo $file): bool => in_array(
$file->getPathname(),
$this->fileList['full_path'] ?? '',
Expand Down
Loading