Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
multiple path vs distributed configuration file #2390
when running a command to apply the cs fixer on all files within the git staging area
the following exception is raised:
Running an alternative on a per-file basis works just fine (from version 1.x).
If I would add the
There are two main reasons I want to use the one-shot:
this is expected.
Please check out this: https://github.com/FriendsOfPHP/PHP-CS-Fixer#using-php-cs-fixer-on-ci
@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.
@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
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
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.