grunt-phpcs icon indicating copy to clipboard operation
grunt-phpcs copied to clipboard

'Referenced sniff "PEAR" does not exist'

Open brian-lamb-software-engineer opened this issue 10 years ago • 1 comments

Im stumped.

in order to get grunt-phpcs running, i did the standard npm install, and configured my Gruntfile.js

phpcs: {
            application: {
                dir: 'src'
            },
            options: {
                bin: '/usr/bin/phpcs',
                standard: '/home/wolfdogg/sites/common/codestandards/PHPCS'
            }
        },

From there i got a series of errors that i was able to trickle through, the first of which i thought maybe i needed to install pear, and PHP_CodeSniffer, but still not sure if the node_module package suffices without the need for this.

So, from there i installed pear on my linux, then i installed 'pear PHP_CodeSniffer'.

after this i made an adjustment to the open_basedir to squelch a php warning on line 28 of /usr/bin/phpcs.

then i was trying to overcome the missing "STANDARDS" problem which i thought was included, now i realize its more of a user preference thing.

it would be great if atleast the PHPCS standard could be included in the npm package so one doesnt have to dig aroudn for it. Once i found it here https://github.com/squizlabs/PHP_CodeSniffer/tree/master/CodeSniffer/Standards i made a new directory in my home directory so i can have a central place for the code sniffer standards until i find a better place for them.

then once i set the path to the directory that contained the ruleset.xml file in my home directory i got stumpled with this new error, pasted below;
I cant tell what this error is.

[]$ grunt phpcs
Running "phpcs:application" (phpcs) task
Starting phpcs (target: application) in src/
Fatal error: Command failed: PHP Fatal error:  Uncaught exception 'PHP_CodeSniffer_Exception' with message 'Referenced sniff "PEAR" does not exist' in /usr/share/pear/PHP/CodeSniffer.php:827
Stack trace:
#0 /usr/share/pear/PHP/CodeSniffer.php(587): PHP_CodeSniffer->_expandRulesetReference(Object(SimpleXMLElement), '/home/wolfdogg/...', 0)
#1 /usr/share/pear/PHP/CodeSniffer.php(435): PHP_CodeSniffer->processRuleset('/home/wolfdogg/...')
#2 /usr/share/pear/PHP/CodeSniffer/CLI.php(612): PHP_CodeSniffer->process(Array, Array, Array, false)
#3 /usr/bin/phpcs(37): PHP_CodeSniffer_CLI->process()
#4 {main}
  thrown in /usr/share/pear/PHP/CodeSniffer.php on line 827

Is this error saying it cant find the PEAR installation, a PEAR directory, or what? I know CodeSniffer is intalled to /usr/share/bin/PHP/CodeSniffer . I dont know why some pear packages insist on not intalling to PEAR instead go to PHP, but oh well.

Can somebody help me make sense of this error?