-
Notifications
You must be signed in to change notification settings - Fork 57
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
Usage with phpcs pear package or standalone phpcs.phar #67
Comments
Hey, what exactly did you try? Code would be helpful Usage is tested and works well |
Usage is tested Is tested for phpcs composer package. In the composer case we just need to install phpcs using composer require. what about global phpcs package?
|
I'm not familliar with using phar or pear, since it doesn't support reliable versioning as comoser. Could you add test for that into |
Can you be able to guide on how do I use this standard with multiple projects without including in every project? |
What exactly do you mean? |
Is this what you are looking for? https://getcomposer.org/doc/03-cli.md#global |
This package is a custom standard for PHPCS. As per the documentation I need to require PHPCS and this package in every project to use the sniffs. If you have gone through the PHPCS composer package, I can use PHPCS in both ways global as well as local. So if I have phpcs installed globally, how can I install/ integrate this package / standard with PHPCS in a global way so that I don't have to add this package to all my project. I can directly use this standard from global installation? |
Run |
I run the above command and received following error
As per the requirement I should have Here is the output of
How can I solve this? |
@rohanvakharia I've tried the same "composer global" setup and it works for me. What operating system do you use? Not sure if bug in composer. Maybe ask in composer issues. |
Ubuntu 16.04 |
Did you run |
/home/rohan/.config/composer/vendor/bin/phpcs src tests -sp --standard=/home/rohan/.config/composer/vendor/object-calisthenics/phpcs-calisthenics-rules/src/ObjectCalisthenics/ruleset.xml |
Btw, I'd recommend using
|
What's state is this in? |
I have multiple projects where I need to run these rules. I have installed a PHPCS standalone(phar file) in my bin folder. That gives me an easy access anywhere from terminal and in sublime as well using linter. The way you are telling me to use that, I will need to add the package in each and every project which is not possible for me. |
I will try install it step by step. FAIL 😢1. Install It# composer create-project <package-name> <destination-directory>
composer create-project object-calisthenics/phpcs-calisthenics-rules object-calisthenics-rules Now this package is located in
object-calisthenics-rules/src/ObjectCalisthenics/ruleset.xml 2. Run It with Own phar/binphp_codesniffer/bin/phpcs standalone-directory/src -sp --standard=standalone-directory/src/ObjectCalisthenics/ruleset.xml That fails with exception the same "Nette\Utils\Strings" exception: This is caused by using extra classes that SOLUTION 🍰When you use standalone-directory/vendor/bin/phpcs standalone-directory/src -sp --standard=standalone-directory/src/ObjectCalisthenics/ruleset.xml All works fine: And you can analyze any directory you need: standalone-directory/vendor/bin/phpcs other-project -sp --standard=standalone-directory/src/ObjectCalisthenics/ruleset.xml Can you try that? |
Thank you for detailed solution. It is a very good work around for my problem. I have tried this solution where I need to install PHPCS package using composer in a standalone directory followed by object calisthenics package which will install a Solution accepted. Just a concern: |
I can send you a PR if you don't mind. |
👍
I though about this but though there are more external dependencies, that would have to be taken care of.
Sure, that would be great! 👏 |
Do you have an idea when do you get to this? |
It won't take more than couple of days as I am working on client's project, will update you once it's done. |
Thanks for the info. |
Closing for time out. Feel free to reopen with PR. |
I was trying to run calisthenics standard for pear package PHPCS but it is not working.
What is the best way to use this with pear package or standalone phar file?
The text was updated successfully, but these errors were encountered: