-
-
Notifications
You must be signed in to change notification settings - Fork 75
Config: can use custom LocalFile object #785
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
Conversation
Thanks for this PR and your willingness to contribute to PHPCS. I'm not keen on this PR as I really don't want to have to deal with support requests/bug reports from end-users using a standard using this feature. That's going to be very messy and will waste everyone's time. Also, as per the CONTRIBUTING guide, please open an issue to discuss proposals instead of opening POC PRs. Those are not welcome. Marking this as close candidate. Also see #137 |
To clarify the above (as I realize I didn't give an example) - with a config setting like proposed in this PR:
|
Sorry, I thought that see the code will be easier to describe the proposal. I totally understand - I can live without this PR, just some thoughts.
I have some external sniffs that also give me just some internal error (in some corner cases) during the file analyses without any context what sniff did this and I have to debug this and disable the concrete sniff for the file. Badly written bootstrap could also fail and you don't know what is wrong.
Ok, I thought about this as an internal thing to use only when you really know what you're doing, that's why it's not possible to change this via command line.
Again, I understand, but I think this could be said also for badly written sniffs, bootstraps, reports etc... |
Actually no. The PR is a potential solution. But it doesn't explain the actual problem. Yes, I know your usecase, but what I still don't know is why that usecase would require this solution. There may be numerous other solutions for your problem, but I can't even begin to imagine those as I still don't know the problem and submitting a PR basically says "this is the only solution I'm interested in" (independently of whether it is the right solution).
All the more reason not to make the potential surface for errors larger by adding a niche feature which is error prone. |
Fair enough :-) You're right. I wrote my package when there was no active development in the original PHPCS package and I prepare my package with an information from this PR squizlabs/PHP_CodeSniffer#3387. Using own I will try to summarise all of this to an issue, maybe there is some better way to achieve this. |
Seeing the referenced issue in the old repo, I again refer you to issue #137 in this repo... |
Sorry, I miss that in your first comment :-( Now I feel silly I didn't find this before open an PR. Thanks :-) |
Description
I'm the author of package PHPCS-Ignores that allows to ignore PHPCS errors/warning in the similar way as PHPStan - you have a file with listed ignores.
To make this happen, I need some extra logic in
LocalFile
class. I'm using my ownLocalFile
that extends the original one.LocalFile
is hardcoded inFileList
. To force PHP_CodeSniffer to use my own class, I do some magic via stream wrapper that updateFileList.php
on the fly. I was thinking if it would be possible to allow this without a hacking throughConfig
class.I prepared a small example that works for me. I'm able to update config entry in bootstrap file, that you must use if you want to use my package.
This is just proof of work, I will add tests later if this change will be approved.
Suggested changelog entry
Internals: can use own LocalFile class.
Types of changes
PR checklist
package.xml
file.