-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add bootstrap file option #783
Add bootstrap file option #783
Conversation
This is an interesting idea, but I feel like it is something that should be included later on in the process. Maybe after all command line arguments have been processed and the run is about to start. Possibly right here: https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/CLI.php#L782 And in the 3.0 branch, probably at the top of the main run() method: https://github.com/squizlabs/PHP_CodeSniffer/blob/3.0/src/Runner.php#L245 Does that still let you do what you need? |
@gsherwood I believe so. I figured it probably wasn't the right place for it, but didn't know where was. The main thing is the bootstrap needs to be run before the sniffs are. (In the example I gave, my use case, we want to make sure Would you like a separate pull request for each branch? |
@johnmaguire No need for two PRs. 3.0 isn't stable yet so it may not work for you. It's also completely different, so I'll port it over based on how I've been converting things in there. If you think the idea of storing the bootstrap location in the |
@gsherwood I hope I understood correctly! I was able to base my code roughly off the sniffs option above as well. |
Exactly what I was thinking. I can't give it a good test right now, but will test and merge tomorrow. Thanks a lot. |
Thanks a lot for the patch. There 3.0 commit is here: 88c587f |
This adds a longopt for specifying bootstrap files. An example of why this might be useful:
You can set a bootstrap file in
ruleset.xml
using the<arg>
element. Previously we were modifying$allowedTypes
in our custom sniff files, but there's a race condition unless you add this to every single sniff file you have (and you end up with lots of dupes unless you runarray_unique
each time.)