1
votes

I seem to be having trouble providing the installed_paths configurable. It seems to sabotage phpcs.

Show installed standards:

$ sudo /usr/bin/phpcs -i
The installed coding standards are PSR2, PHPCS, PEAR, PSR1, Squiz, MySource, Zend, CakePHP, PSR2, PHPCS, PEAR, PSR1, Squiz, MySource, Zend and CakePHP

Show default installed_paths value:

$ sudo /usr/bin/phpcs --config-show
Array
(
    [installed_paths] => /usr/share/php/PHP/CodeSniffer/Standards
)

If I pass the default installed_paths value explicitly in with --config-set, it no longer shows any installed standards:

$ sudo /usr/bin/phpcs --config-set installed_paths /usr/share/php/PHP/CodeSniffer/Standards -i
$

I have the latest stable version of PHP_CodeSniffer (1.5.4), and it looks like they added this in 1.5.1. Has anyone had success?

1
Just a note that --config-set sets the config variable and then exits. You can't use -i and --config-set at the same time. You'll need to use --runtime-set if you want to set it for a single run only and --config-set if you want it written to the config file. - Greg Sherwood
Also note that there is no default installed_paths value in PHPCS, so you must have set that value yourself. The installed_paths config var defines additional locations in which PHPCS should look for standards. It will always include the ones that ship with PHPCS. - Greg Sherwood
@GregSherwood I don't know. I just installed it within the last day or two, and it was there when I checked. Thanks for mentioning --runtime-set. In the end, I just started passing the ruleset file to --standard. - Dustin Oprea

1 Answers

1
votes

As @GregSherwood mentioned in the comment, the correct parameter is --runtime-set. --config-set updates the config file and exits immediately.