-
Notifications
You must be signed in to change notification settings - Fork 435
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
Allow php-cs-fixer to autofix #110
Comments
Hi @tacone, Thanks for propising this feature. Personally I am not a big fan of manipulating code automatically right before a commit. I also have 2 other concerns:
What are your views on the topics above? |
Hello @veewee, thank you for the thoughtful reply. You are right in what you say, and I agree with you that the dry run is a sensible choice and should be kept as default. Regarding the concerns, it is possible even if unlikely that php-cs-fixer would mess up something. It is very unlikely that will change the actual behavior of the code or the result of the other tests. My take on the whole matter is very simple: if GrumPHP will not let you commit without fixing, then you are going to fix anyways, automatically or not. I agree with you that manually fixing gives you more control. |
Hi @tacone, I don't have a problem with the automatic fixing, but with the automatic At that point the phpcsfixer task should not throw any exceptions, but it is recommended that the ouput of the task is shown in a non-blocking way. (See #17) Not sure that when you ask a question in GUI tools, they will also prompt the question the the user. So this is something we will need to take a look at. |
Yes, I understood that. The issues you raise are worth considering. I guess that the best short term solution to adjust for my workflow is just creating a custom task and live with it. Thank you for now :) |
@veewee Why not make it optional to run the cs fixer? By default it doesn't fix the issues, but in the YAML file you can enable this. |
As mentioned above: there are multiple problems with auto fixing the code. For me, the big problem remains that you are committing code that you don't control. I want to avoid issues like "GrumPHP eats my code" when there is actually an issue in cs-fixer. The way I see it, this feature is more a PITA then a feature somebody would want to use. |
For people who really want to use this feature; we created an seperate repository with this task. Check it out. https://github.com/wearejust/grumphp-extra-tasks |
@veewee Can you please consider adding this option? If you don't use it personally, that is fine - but it would be great to at least have the choice. https://github.com/wearejust/grumphp-extra-tasks is working fine. |
I've installed GrumPHP Extra tasks via
while I was committing my files this shows an error: PHP Fatal error: Declaration of Wearejust\GrumPHPExtra\Extension\Loader::load(Symfony\Component\DependencyInjection\ContainerBuilder $container) must be compatible with GrumPHP\Extension\ExtensionInterface::load(Symfony\Component\DependencyInjection\ContainerBuilder $container): void in /home/fatima/code/programs/vendor/wearejust/grumphp-extra-tasks/src/Extension/Loader.php on line 17 |
Hello, I would like to propose to make
--dry-run
optional. I understand auto-fixing may not suit everyone's needs, but I find it terribly handy.Before finding about grumphp I even put together a simple package to accomplish that. I would be so happy to dump my homegrown solution for something like grumphp, but I know I'd miss the auto-fixing too much.
What do you think? It seems something very easy to accomplish, let me know if you can do it or you would like a pull request.
The text was updated successfully, but these errors were encountered: