magento-ecg / coding-standard

Magento PHP_CodeSniffer Coding Standard
MIT License
308 stars 100 forks source link

exception thrown in /usr/share/php/PHP/CodeSniffer.php #29

Closed rossmc closed 8 years ago

rossmc commented 8 years ago

I've tried using this tool but when I try to run it I get an exception thrown in /usr/share/php/PHP/CodeSniffer.php on line 786

I feel I must be just running the command correctly? Would really appreciate any advice.

~:$ php -v
PHP 5.5.9-1ubuntu4.6 (cli) (built: Feb 13 2015 19:17:11) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
~:$ phpcs --version
PHP_CodeSniffer version 1.5.0RC2 (beta) by Squiz Pty Ltd. (http://www.squiz.com.au)
~:$ git clone https://github.com/magento-ecg/coding-standard.git
Cloning into 'coding-standard'...
remote: Counting objects: 305, done.
remote: Total 305 (delta 0), reused 0 (delta 0), pack-reused 305
Receiving objects: 100% (305/305), 46.77 KiB | 0 bytes/s, done.
Resolving deltas: 100% (153/153), done.
Checking connectivity... done.       
~:$ cd coding-standard/
coding-standard: (master)$ phpcs --standard=/home/ubuntu/coding-standard/ruleset.xml /var/www/magento1-9
PHP Fatal error:  Uncaught exception 'PHP_CodeSniffer_Exception' with message 'Referenced sniff "Generic.PHP.Syntax" does not exist' in /usr/share/php/PHP/CodeSniffer.php:786
Stack trace:
#0 /usr/share/php/PHP/CodeSniffer.php(564): PHP_CodeSniffer->_expandRulesetReference(Object(SimpleXMLElement), '/home/ubuntu/codi...', 0)
#1 /usr/share/php/PHP/CodeSniffer.php(419): PHP_CodeSniffer->processRuleset('/home/ubuntu/codi...')
#2 /usr/share/php/PHP/CodeSniffer/CLI.php(614): PHP_CodeSniffer->process(Array, Array, Array, false)
#3 /usr/bin/phpcs(37): PHP_CodeSniffer_CLI->process()
#4 {main}
  thrown in /usr/share/php/PHP/CodeSniffer.php on line 786
Zifius commented 8 years ago

You seem to be running very old phpcs version, current is 2.3.4 https://github.com/squizlabs/PHP_CodeSniffer/releases

bartkibilko commented 8 years ago

I solved the problem with renaming repo name to "Ecg" ;)