Skip to content

Commit

Permalink
Merge branch 'directory-exclude-pattern' of https://github.com/Solviq…
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Sep 1, 2020
2 parents d2deedd + 367c60c commit 85f3521
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Filters/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ protected function shouldIgnorePath($path)
// Need to check this pattern for dirs as well as individual file paths.
$this->ignoreFilePatterns[$pattern] = $type;

$pattern = substr($pattern, 0, -2);
$pattern = substr($pattern, 0, -2).'(?=/|$)';
$this->ignoreDirPatterns[$pattern] = $type;
} else {
// This is a file-specific pattern, so only need to check this
Expand Down
6 changes: 5 additions & 1 deletion tests/Core/Filters/Filter/AcceptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,13 @@ public function dataExcludePatterns()
'/path/to/src/Main.php',
'/path/to/src/Something/Main.php',
'/path/to/src/Somethingelse/Main.php',
'/path/to/src/SomethingelseEvenLonger/Main.php',
'/path/to/src/Other/Main.php',
],
['/path/to/src/Main.php'],
[
'/path/to/src/Main.php',
'/path/to/src/SomethingelseEvenLonger/Main.php',
],
],

// Test ignoring standard/sniff specific exclude patterns.
Expand Down

0 comments on commit 85f3521

Please sign in to comment.