Comments (13)
I read the discussion at: PHP-CS-Fixer/PHP-CS-Fixer#1719
One thing we could do is read the .php_cs configuration file and use the configured finder to filter the files in our resultset. Not sure if this is possible and how it should be done, but I think this is the best option which will also speed up the phpcsfixer task in GrumPHP. (Currently the phpcsfixer is pretty slow because the tool runs for every committed file. It was on my checklist to take a look on how to improve this speed.)
Would this possible solution solve your issue?
from grumphp.
Your solution seems interesting and I think it should solve this issue :)
from grumphp.
Please play with PHP-CS-Fixer/PHP-CS-Fixer#1742
from grumphp.
I just took a look at the commit and it will probably solve @tifabien's problem.
Yesterday I started on a similar approach, but in GrumPHP: veewee@77bfdf4
As you can see, the phpcsfixer configuration is being loaded and an intersection between the finder in phpcsfixer and the commited files in GrumPHP is being made. This was mostly done for starting less phpcsfixer commands, but would also fix this problem.
Just out of curiousity: might it also be an option to add multiple directories / files to the CLI arguments?
Currently we have to start phpcsfixer for every file that is being changed during a commit. This is a pretty slow task.
from grumphp.
I started mine yesterday as well ;)
Your solution would be problematic when one want to run GrumPHP
with PHP CS Fixer v2@dev
, as you start using the PHP CS Fixer classes.
That is exactly my goal, but first I will need to deal with PHP-CS-Fixer/PHP-CS-Fixer#1744 and probably PHP-CS-Fixer/PHP-CS-Fixer#1666
from grumphp.
Okay, that would be great! So I guess there is nothing we can do in our project. I don't think this cross version support is soemthing we want to add to GrumPHP.
We will have to wait until this is fixed in php-cs-fixer and for the multiple files until this is implemented.
from grumphp.
So I guess there is nothing we can do in our project.
You can do it on your end but not sure is it needed to be implemented twice.
I don't think this cross version support is soemthing we want to add to GrumPHP.
That could be tricky indeed.
One question about it - when there will be PHP CS Fixer 2.0, you will only support 1.x or 2.x ?
from grumphp.
Not sure yet. I haven't looked at phpcsfixer v2 yet.
If the CLI is more or less the same, it might be possible to support both.
If that is not possible, we will probably force the usage of v2 at some point.
It's a development tool, so I guess that won't be a big problem to upgrade.
from grumphp.
Guide for CLI usage upgrade: https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/UPGRADE.md
May be useful.
from grumphp.
Looks great! Thanks!
from grumphp.
@keradus: It seems like the 2 issues in php-cs-fixer you mentioned got merged. Is this issue resolved?
from grumphp.
Hi @veewee ,
PHP-CS-Fixer/PHP-CS-Fixer#1742 is merged indeed, but it's merged into 2.x@dev line (not 1.x@stable).
Anyway, I think this is more an issue of PHP CS Fixer, and as such there is no need for having the issue opened here, as grumphp may be considered as tool-runner.
from grumphp.
Ok, Thanks!
from grumphp.
Related Issues (20)
- Consider adding a `composer.lock` file in the repository HOT 14
- phpcs does not detect default ruleset xml file HOT 6
- PHPMD task does not check all file extensions HOT 5
- Don't do commit message checks on merges? HOT 8
- Memory is not being released in parallel execution HOT 2
- Grumphp running without `.git` folder? HOT 4
- Print the commit message when failing on `git_commit_message` HOT 4
- how can I use grum with docker-compose ? HOT 3
- Fails to Recognize PHPStan Baseline During Commit Workflow
- Override open_basedir only for grumphp test HOT 2
- Grumphp config using default PHPCS XML and other standard's sniff HOT 2
- Undefined constant PhpParser\ParserFactory::PREFER_PHP7 when using `nikic/php-parser` version 5. HOT 1
- Support multiple php versions for tasks HOT 2
- [Task] Add bin/console task for Symfony HOT 1
- husky/lint-staged compatibility HOT 5
- The application requires the version "^7.2" or greater. HOT 2
- Support for multiple PHPStan tasks HOT 2
- How do you think about a configuration to opt-in to continue the commit if fixer could fix everything automatically? HOT 2
- DistFileLoader doesn't import another file
- Add support for git_pre_push HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grumphp.