error when no files will be processed#4326
Conversation
|
@7thstorm could you verify this matches your expectations? |
|
@staabm if no path specified in command arg, is it still working? |
yes: |
|
@samsonasik can this be merged? |
|
I will let @TomasVotruba decide on it |
| $this->dynamicSourceLocatorDecorator->addPaths($paths); | ||
| if ($this->dynamicSourceLocatorDecorator->isPathsEmpty()) { | ||
| $this->rectorOutputStyle->error("The given paths do not match any files"); | ||
| return ExitCode::FAILURE; |
There was a problem hiding this comment.
while probably rare usecase, I think show warning only is better than return error, to avoid a use case that file already removed via other rector rule.
There was a problem hiding this comment.
not sure how files which are deleted from rector itself can affect the configuration-paths?
There was a problem hiding this comment.
User may can create a custom FileProcessor, which may delete file on specific use, then on parallel, it called on separate rules.
For DX perspective, I think stop and retry should not happen, and this also doesn't give information which part that empty.
sorry, I was out of town. I'm using Rector 0.17.1 how do I test new update? But it seems the proposed change ""The given paths do not match any files" should be good enough |
|
@7thstorm you could checkout this pull request and run rector from the project root with |
|
Let's ship this to @staabm Thank you for this DX improvement 👍 |
|
@staabm it seems cause error in e2e test in rector/rector, see https://github.com/rectorphp/rector/actions/runs/5382084725/jobs/9767016438#step:5:1 |
|
@staabm The error seems because no path specified, it possibly that previous behaviour, when no path specified, it go to current directory as |
|
Will have a look a tomorrow |
|
The original behaviour is probably incorrect, as it prevoiusly shows: see https://github.com/rectorphp/rector/actions/runs/5381537795/jobs/9765738995#step:5:1 which if applied, it should show: ➜ finalize git:(main) ✗ php ../../bin/rector.php --dry-run
2/2 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
1 file with changes
===================
1) src/SomeClassWithoutChildren.php:3
---------- begin diff ----------
@@ @@
namespace Rector\e2e;
-class SomeClassWithoutChildren
+final class SomeClassWithoutChildren
{
}
----------- end diff -----------
Applied rules:
* FinalizeClassesWithoutChildrenRectorbut I probably missing something, I will let you check ;) |
I think you are right, that the test is bogus |
before this PR:
$ php bin/rector process some/unkown/file.php --dry-run -vvv [OK] Rector is done! $ echo $? 0 # non-error exit codeafter this PR:
$ php bin/rector process some/unkown/file.php --dry-run -vvv [ERROR] The given paths do not match any files $ echo $? 1 # error exit coderefs rectorphp/rector#8003 (comment)