Skip to content
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

Getting an error when trying to run #2

Closed
jwalton512 opened this issue Dec 9, 2014 · 12 comments
Closed

Getting an error when trying to run #2

jwalton512 opened this issue Dec 9, 2014 · 12 comments

Comments

@jwalton512
Copy link

I installed globally via composer

Getting the error below when I try to run with Laravel Standard

ERROR: the "~/.composer/vendor/pragmarx/laravelcs/Standards/Laravel" coding standard is not installed. The installed coding standards are MySource, PEAR, PHPCS, PSR1, PSR2, Squiz and Zend

Just running phpcs works fine.

@antonioribeiro
Copy link
Owner

Check if you have a folder ~/.composer/vendor/pragmarx/laravelcs

On Linux/Mac:

ls -la  ~/.composer/vendor/pragmarx/laravelcs

@jwalton512
Copy link
Author

Yep, that directory is there -- here are a few pertinent results:

➜  ~  ls -lah ~/.composer/vendor/pragmarx/laravelcs
total 24
drwxr-xr-x   7 jason  staff   238B Dec  9 07:57 .
drwxr-xr-x   3 jason  staff   102B Dec  9 07:57 ..
drwxr-xr-x  15 jason  staff   510B Dec  9 07:57 .git
-rw-r--r--   1 jason  staff   1.5K Dec  9 07:57 LICENSE
drwxr-xr-x   4 jason  staff   136B Dec  9 07:57 Standards
-rw-r--r--   1 jason  staff   455B Dec  9 07:57 composer.json
-rw-r--r--   1 jason  staff   2.7K Dec  9 07:57 readme.md
➜  ~  phpcs ~/Development/laravel-framework/src/Illuminate/Cache/Console/CacheTableCommand.php

FILE: ...nt/laravel-framework/src/Illuminate/Cache/Console/CacheTableCommand.php
--------------------------------------------------------------------------------
FOUND 98 ERRORS AFFECTING 60 LINES
--------------------------------------------------------------------------------
  1 | ERROR | [ ] Missing file doc comment
  7 | ERROR | [ ] Missing class doc comment
  7 | ERROR | [x] Opening brace of a class must be on the line after the
    |       |     definition

... shortened for brevity
➜  ~  phpcs --standard=~/.composer/vendor/pragmarx/laravelcs/Standards/Laravel ~/Development/laravel-framework/src/Illuminate/Cache/Console/CacheTableCommand.php
ERROR: the "~/.composer/vendor/pragmarx/laravelcs/Standards/Laravel" coding standard is not installed. The installed coding standards are MySource, PEAR, PHPCS, PSR1, PSR2, Squiz and Zend

@antonioribeiro
Copy link
Owner

That was tough. Looks like PHP_CodeSniffer doesn't accept standards inside hidden folders like ~/.composer, so copying it to /tmp worked:

cp -a ~/.composer/vendor/pragmarx/laravelcs /tmp
phpcs -v --standard=/tmp/laravelcs/Standards/Laravel/ /tmp/laravelcs/Standards/TestFiles/Filesystem.php

Now I just have to fix this... :(

/cc @mvpasarel

@antonioribeiro
Copy link
Owner

Looks like they knew & fixed it:

http://pear.php.net/package/PHP_CodeSniffer/download/All

  • Standards can now be located within hidden directories (further fix for bug #20323)

This should work on 2.0.0RC2, but I have 2.0.0 (stable) and it's not.

@antonioribeiro
Copy link
Owner

Not sure if it was fixed here or not: squizlabs/PHP_CodeSniffer#254

@mvpasarel
Copy link
Contributor

Hmm... The problem seems to be from the ~/ because I actually tested it with /Users/mvpasarel/.composer/... and is working with .composer hidden directory.

I can change the readme to use the full path only.

@xsbeats Can you try with the full path please?

@antonioribeiro
Copy link
Owner

You're right! I'll change it. Thanks.

@mvpasarel
Copy link
Contributor

While you're there, I have a typo as well at Usage wih, please change that too. Thanks.

@antonioribeiro
Copy link
Owner

Done and done.

You can run it using:

phpcs -v --standard=$HOME/.composer/vendor/pragmarx/laravelcs/Standards/Laravel /path/to/folder/or/file

@antonioribeiro
Copy link
Owner

I also opened an issue on CodeSniffer: squizlabs/PHP_CodeSniffer#353, they should use realpath() to convert those paths before start to traverse them...

@antonioribeiro
Copy link
Owner

I also created a pull request to fix it on CodeSniffer: https://github.com/squizlabs/PHP_CodeSniffer/pull/354/files

@jwalton512
Copy link
Author

thanks @antonioribeiro @mvpasarel. working great now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants