-
-
Notifications
You must be signed in to change notification settings - Fork 708
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
Add rector.yaml to .dockerignore #1694
Conversation
This is the rector configuration file for developing on rector itself, and should not be used in runtime. Without this change, the docker image (which runs with `/rector` as its working directory) would use this `rector.yaml` as the default configuration file. This leads to unexpected effects, such as rector ignoring any `tests/`-directory by default.
Please, what exact command are you trying to run? You always need either some set or config to run rector with, right @TomasVotruba ? I see what your issue is, but i need more data, to make sure you are using the Docker image in correct way. @TomasVotruba if someone runs rector with |
I'm running
This skips all files within the
it correctly finds the test files. |
Thank you! @TomasVotruba what do you think about ignoring and not requiring |
What's common approach for CLI tools with non-config sets out there? E.g. |
I think they all need some config and do not support running without that, but nothing really similar that rector has - you have for example prepared yaml configs that can be used instead of writing your config, that is imho same thing as |
The sets only contain rules. The rector.yaml is needed to load parameters, e.g. PHP version etc. So this is expected behavior. Not sure how this is related to Docker though |
I see now, that's the issue |
Thanks for the PR! |
Well, this is not true. I tried the command above and it works without any rector.yaml - by adding it to .dockerignore it is missing and either project has no rector.yaml file and it still works.
So the behavior is maybe not documented, but it works by some magic 😄 |
You're read it too conditionally :D It is needed, IF you want to configure parameters |
Ok, i think i undestand now 😄 im looking forward to the prefixed version, with that we will be able to set working directory inside of docker to project instead of rector's working diretory, i feel this is more likely workaround than solution of a problem. But it works, so thank you for PR 😉 |
As Steve would say: "Better done than perfect" :) |
Thanks for the quick merge! |
rectorphp/rector-src@9d781bb Do not run on properties with attributes (#1694)
Context:
I'm trying to use the Rector docker image to upgrade a testsuite from PHPUnit 6 to PHPUnit 8.
Symptom:
Rector refuses to process files in a directory named
tests
. It only finds these files if I create an 'empty'rector.yaml
configuration file in my project and specify it on the command line using the-c
flag.Analysis:
It turns out that when no config file is specified as a command line option, Rector looks for one in its current working directory. In the docker image, this is
/rector
, the directory containing the source files of Rector itself. Among these isrector.yaml
, which is the Rector configuration file for developing on rector itself (at least I think so). This file contains an exclude pattern for/tests/
, which is useful when working on Rector itself, but is now also used as an exclude when applying Rector on another project.Proposed solution:
The
rector.yaml
configuration file for developing on rector itself should never be used by default in runtime. We can do so by adding it to.dockerignore
, so that it is excluded from the docker image.