-
-
Notifications
You must be signed in to change notification settings - Fork 707
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
Running rector from Docker #2186
Comments
Hi @gnutix please to help me better understand your situation, could you paste exact command you are trying to run? |
So I've changed from running Rector using this command :
to this one :
Which required, in order to work, to change my |
I am looking into that. Expected and desired behaviour is definitely to work with Rector in docker in same way, without need of changing paths in your config. |
Anyways i have an idea - did your "migration" to docker include uninstalling rector from your composer dependencies? That would lead into |
Indeed. Removing |
@TomasVotruba i would like your opinion here. This is caused by file We can either:
Thank you in advance for your feedback |
I don't understand the issue. How other container PHP apps require their configs? |
Okay, i will try to explain again and more verbose 😄 This is not related to Docker at all. Composer.json: "require-dev": {
"rector/rector": "dev-master"
}, Now Then But, if you run rector from docker, this file is available at I proposed 3 solutions. Can we pick one or come with another? |
Would there be a way to allow relative paths from the imports:
- { resource: 'set/code-quality/code-quality.yaml' }
- { resource: '%rector.config%/set/code-quality/code-quality.yaml' } |
Where is this in our code? - { resource: 'vendor/rector/rector/config/set/code-quality/code-quality.yaml' } The path should be indeed relative |
Yeah, but it's relative to the position of the |
Of course, that's expected. If the config is missing, there should be an error |
How does PHPStan approach this? |
I tested it and PHPStan has |
I'm open to PR for the variable then |
This will help: #2221 :) |
I've tried using this new syntax on $ docker run -v $(pwd):/project rector/rector:latest process /project/src /project/tests --config /project/rector.yaml --autoload-file /project/vendor/autoload.php --ansi --dry-run
Fatal error: Uncaught Nette\FileNotFoundException: File '/rector/vendor/symplify/phpstan-extensions/config/config.neon' is missing or is not readable. in /rector/vendor/nette/di/src/DI/Config/Loader.php:43
Stack trace:
#0 /rector/vendor/nette/di/src/DI/Config/Loader.php(60): Nette\DI\Config\Loader->load('/rector/vendor/...', false)
#1 /rector/vendor/nette/di/src/DI/Compiler.php(127): Nette\DI\Config\Loader->load('/rector/phpstan...', false)
#2 /rector/vendor/nette/bootstrap/src/Bootstrap/Configurator.php(258): Nette\DI\Compiler->loadConfig('/rector/phpstan...', Object(Nette\DI\Config\Loader))
#3 /rector/vendor/nette/di/src/DI/ContainerLoader.php(119): Nette\Configurator->generateContainer(Object(Nette\DI\Compiler))
#4 /rector/vendor/nette/di/src/DI/ContainerLoader.php(79): Nette\DI\ContainerLoader->generate('Container_48b06...', Array)
#5 /rector/vendor/nette/di/src/DI/ContainerLoader.php(44): Nette\DI\ContainerLoader->loadFile('Container_48b06...', Array)
#6 /rector/vendor/nette/bootstrap/src/Bootstrap/Configurator.php(2 in /rector/vendor/nette/di/src/DI/Config/Loader.php on line 43 And on $ docker run -v $(pwd):/project rector/rector:0.5.20 process /project/src /project/tests --config /project/rector.yaml --autoload-file /project/vendor/autoload.php --ansi --dry-run
Rector No version set (parsed as 1.0.0)@
Config file: ../project/rector.yaml
1/822 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0%
Fatal error: Declaration of PhpParser\Node\Name::getSubNodeNames() must be compatible with PhpParser\Node::getSubNodeNames(): array in /project/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php on line 196 Locally, I'm running PHP 7.3, and the Docker image does too. Our project is using PHP 7.2. I find it weird that Here's my config : https://gist.github.com/gnutix/4080142ecce07696035e19bdcb8c3d31 |
Always try the lastest version, if not Import works correctly. The Fatal error is cause by issues related to: #177 |
I can only chose Still gives me the |
@TomasVotruba I was indeed missing a call to
And #177 had not been touched for months, so I'm not sure it's really relevant ? |
It seems to be more a duplicate of #2178 |
Yes, there were many similar errors - just check "Fatal error" in Rector issues. But it has one common point of origin. Here is the problem that happens: |
Indeed, my code is using So I looked deeper into this, and I've seen a comment of yours where you proposed to explain what would be needed to build Rector in a phar. Would you mind doing that ? I might then be able to give it a shot (as it would benefit the new project I'm working on to be able to run Rector). |
Let's continue in #177 |
rectorphp/rector-src@8332d8c remove unused unwrapExpression(), use direct instanceof compare instead (#2186)
I've recently changed my setup to run Rector from Docker instead of including it in my composer.json to avoid #1899 . And it feels to me like one of the "migration step" is not currently documented, which is updating the paths in my
rector.yaml
file'simports
section, like this :Or did I "do it wrong" ?
The text was updated successfully, but these errors were encountered: