-
Notifications
You must be signed in to change notification settings - Fork 69
Add files filter #264
Add files filter #264
Conversation
…n this option and files found by finder will be made
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not gonna lie, I much prefer this approach to #263 :)
@humbug/core WDYT?
src/Command/Humbug.php
Outdated
|
|
||
| if (isset($paths)) { | ||
| $finder->filter(function (SplFileInfo $file) use ($paths) { | ||
| return \in_array($file, $paths); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the leading backslash can be removed
| ->addOption( | ||
| 'path', | ||
| 'p', | ||
| InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for the !, a . is enough :)
README.md
Outdated
| humbug --path=src/Data/NewClass.php --path=src/Driver/Driver.php | ||
| ``` | ||
|
|
||
| This in no way restricts the initial Humbug check on the overall test suite which |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a Note:
|
@holysleeper the changes LGTM but the tests are still failing |
|
@theofidry I saw the fails, I will fix them asap :). Thanks. |
| } | ||
|
|
||
| if (isset($paths)) { | ||
| if (!is_null($paths) && count($paths) > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what was the problematic value? I though it could only be an array or null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When --path option is not present, the default value is an empty array. Because of that "return in_array" is always false.
|
Thanks very much @holysleeper :) |
I've added the option 'path' for full path files to mutate. Files from path with be intersected with the files found by Symfony/Finder using config directory and 'file' option.
Ex:
Config:
{ "timeout": 10, "source": { "directories": [ "src" ], "excludes": [ "vendor", "tests" ] }, "logs": { "json": "humbug/humbuglog.json" } }Command:
Files found by Symfony/Finder:
Running the command with the config above the mutated files will be: