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
multiple path vs distributed configuration file #2390
Comments
this is expected. Please check out this: https://github.com/FriendsOfPHP/PHP-CS-Fixer#using-php-cs-fixer-on-ci |
I see, so there is currently no way to get both features working at the same time? |
Multiple files from commandline was requested before, can't recall why this is not possible |
multiple file is working, from what i understand he want to have it without config file |
@havvg its very problematic to determine correct config file / default fallback when you have multiple paths, especially if one would have file A, second file B, and 3rd default fallback. That's the reason the path to config is required while providing multiple paths. I strongly advise to make a project configuration file even if one doesn't use multiple path argument. |
I agree with @keradus. Our current system is already sophisticated enough for most, and I don't think it would be a good idea to make it more complex. |
I mean when you pass multiple files (not directories) by command line and no config is found, we could use the default (or commandline provided rule (sets)), same as we do when one file is passed. I didn't mean adding more layers of configuration resolving. |
where would you look for the config ? this is the problematic part. |
@keradus I think there is some kind of misunderstanding :) What I mean is the following: I run a command like The two features I want to combine is the config mechanism using either |
so, why can't you specify |
Because it's an alias, which is used across many projects, some of them don't have a |
Then, for the sake of clean and safe solution, when we are not juggling which config will be used and how, we decided to require configuration parameter for multi-paths call. embrace that ;) |
@havvg You could use this workaround: |
Thank you @gharlan, I will take a look into this solution. @keradus I don't get the distinction. What's the issue with applying the same rule for a single path? It's not like I'm randomly using paths where each path may yield a different configuration file, but all paths use the very same configuration when issued on the same CLI call. I see your point, if one would randomly use paths where each path is separate in its configuration. However, I would guess the 80% use-case would reflect all given paths being part of the same project/base, sharing the same configuration as if you call all the paths (without |
the issue is when one will run cli command from root path and point multiple paths to different projects. |
[PhpCsFixer\ConfigurationException\InvalidConfigurationException] For multiple paths config parameter is required. PHP-CS-Fixer/PHP-CS-Fixer#2390
[PhpCsFixer\ConfigurationException\InvalidConfigurationException] For multiple paths config parameter is required. PHP-CS-Fixer/PHP-CS-Fixer#2390
Please can this issue be reopened? It still has not been fixed.
Exactly. I am experiencing the same issue. Among other things, this bug - the failure to behave as described in the passage I quoted above - seems to needlessly reduce or eliminate compatibility between PHP-CS-Fixer and the standard POSIX tool None of the proposed workarounds seem satisfactory. The ability for a tool to be able to accept more than one input file, listed by the user as arguments on the command-line, is a long-standing UNIX convention. Here are some examples of PHP-CS-Fixer invocations that would, if PHP-CS-Fixer's CLI followed standard POSIX/UNIX-like conventions, succeed in fixing the files whose paths are being passed. Currently, due to this bug, these invocations fail to perform those fixes and instead simply produce error messages.
The PHP version you are using (
|
Writing again in 2 years old issue doesn't help @sampablokuper . Due to complexity of determining single configuration for all passed paths, like sometimes given dir path can contain it's own config inside, sometimes not, sometimes there is config in cwa, sometimes not, we decided to require a config file argument, as error you got ask you for it, when multiple paths are passed. Simply provide config file and you can benefit from passing multiple paths. |
As such, my comment was helpful and constructive feedback, and I would be glad if it could be appreciated in that vein.
Exactly. This is the bug. It was a decision that damaged PHP-CS-Fixer's CLI's usability by breaking with standard UNIX-like CLI behaviour. Additional evidence that it is indeed a bug is that the documentation produced by
Note the ellipsis.
How is this even a problem? Have a cascade of default behaviours, like other CLI tools have. Something like:
I don't know what you mean by "cwa", sorry. |
not a bug present, but feature missing.
nothing new were presented
not, if thread was few years (!!!) old and was referring to completely different state of software.
As said, whole input of yours, in those 10 comments or so, can be compressed into "I want the feature, but I will ignore your welcome to open a PR myself"
no, this was a conscious decision; we decided than it's better than disallowing for passing multiple paths.
not an evidence at all, it said you can provide multiple paths - and you can. But for that, you need to fulfill requirement of passing config file explicitly.
apparently, it was a problem for us.
|
Hi there,
when running a command to apply the cs fixer on all files within the git staging area
git diff-index --cached --name-only --diff-filter=ACMR HEAD | xargs php-cs-fixer fix
the following exception is raised:
Running an alternative on a per-file basis works just fine (from version 1.x).
git diff-index --cached --name-only --diff-filter=ACMR HEAD | xargs -n1 php-cs-fixer fix
If I would add the
config
option, I'm loosing the default configuration fallback mechanism (.php_cs
,.php_cs.dist
). What is the expected way to combine both features in a one-shot command?There are two main reasons I want to use the one-shot:
2.81s user 0.09s system 99% cpu 2.912 total
vs28.36s user 11.14s system 91% cpu 42.974 total
on a 430 files sample.The text was updated successfully, but these errors were encountered: