Skip to content

Add --exclude option to check-conflicts command - #127

Merged
TomasVotruba merged 1 commit into
mainfrom
add-exclude-to-check-conflicts
Jun 2, 2026
Merged

Add --exclude option to check-conflicts command#127
TomasVotruba merged 1 commit into
mainfrom
add-exclude-to-check-conflicts

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Summary

Adds an --exclude option to the check-conflicts command, so given paths can be skipped when scanning for unresolved git conflicts.

vendor/bin/swiss-knife check-conflicts . --exclude vendor --exclude tests/fixtures

Changes

  • CheckConflictsCommand::run() now accepts an array $exclude = [] parameter (--exclude), passed through to the finder.
  • FilesFinder::find() gained an optional array $excludedPaths = [] argument. Excluded paths are filtered out via a Finder::filter() closure (matching by str_contains on the real path, plus fnmatch for * globs), mirroring the existing PhpFilesFinder behavior since notPath() does not work with absolute paths.
  • Added FilesFinderTest covering the default find, exclude-by-path, and exclude-by-glob cases.
  • Documented the new option in the README.

Testing

  • vendor/bin/phpunit tests/Finder/FilesFinderTest.php — passes (3 tests)
  • ECS, Rector (dry-run), PHPStan (level 8) — all green
  • Manual smoke test confirms a conflict in an excluded directory is skipped

Note: one pre-existing unrelated test failure in NamespaceToPSR4CommandTest exists on main and is untouched by this change.

@TomasVotruba
TomasVotruba merged commit d45c6fa into main Jun 2, 2026
8 checks passed
@TomasVotruba
TomasVotruba deleted the add-exclude-to-check-conflicts branch June 2, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant