Hidden file scanning support with an option #3929
soullivaneuh
started this conversation in
Ideas
Replies: 1 comment
-
Loosely related to #2916. I can imagine a change that if - and only if - a dot-prefixed file is explicitly passed using the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
Currently, phpcs is completely ignoring hidden file from its scanning process:
By digging on the code, I figured out it looks to be intended:
PHP_CodeSniffer/src/Ruleset.php
Lines 634 to 637 in 7763e2e
Also, this problematic was already reported in #1928 but closed without solution because it will introduce a breaking change that not worth it regarding the interest of the feature.
Concern and interest
In my opinion, considering the scan of hidden files "because it is worthless" is a matter of opinion and we should let the user decide about that.
For my case, I have some special hidden files that are written in PHP and I would like them to be scanned by the linter as well.
This is, for example, the case of the php-cs-fixer's configuration file, named
.php-cs-fixer.dist.php
.@gsherwood On #1928, you said this kind of feature addition will introduce a breaking change. May you please elaborate about which kind of breaking change would be introduced here? I am assuming the breaking change would be the tool being scanning additional files "by itself" once updated. Am I right?
Feature proposal
The proposal is simple: Let the tool being able to scan hidden files. According to what I found above, the implementation would be quite simple, meaning adapting the skip condition.
However, we still have the breaking change concern. For that, I propose to add CLI options named
--include-hidden-files
and--skip-hidden-files
(or similar).For the current major version (v3), the
--skip-hidden-files
would be the default option, which will produce the same behavior as before.On the next major version (v4), I suggest to make
--include-hidden-files
the default which make more sense to me, regarding my statement about the "matter of opinion" fact.What do you think about that?
Thanks for the reading!
Beta Was this translation helpful? Give feedback.
All reactions