-
-
Notifications
You must be signed in to change notification settings - Fork 374
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
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 |
@@ -72,6 +72,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int | |||
|
|||
// 1. add files and directories to static locator | |||
$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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure how files which are deleted from rector itself can affect the configuration-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.
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:
* FinalizeClassesWithoutChildrenRector but I probably missing something, I will let you check ;) |
I think you are right, that the test is bogus |
before this PR:
after this PR:
refs rectorphp/rector#8003 (comment)