-
Notifications
You must be signed in to change notification settings - Fork 118
Installing and configuring codesniffer
Path examples here are given for a current MAMP installation. Paths may vary on other installations, but the concepts remain valid.
Ensure that PEAR is installed on your machine.
From the terminal running
which pear
will tell you where pear is installed on your machine. On a current MAMP installation this will be in
/Applications/MAMP/bin/php/php5.4.10/bin/pear .
It will simplify things for you if you create a symlink to the executable using
sudo ln -s /Applications/MAMP/bin/php/php5.4.10/bin/pear /usr/bin/pear
Running pear config-show will show the full pear configuration on your screen.
Simply run
pear install PHP_CodeSniffer
in a terminal window, and pear will install CodeSniffer on your machine. Then run
pear config-get php_dir
to see where your version of pear keeps the files it retrieves. On a current MAMP setup this will be in /Applications/MAMP/bin/php/php5.4.10/share/pear
Add the discovered directory to the path in your php.ini file. e.g.
include_path = ".:/Applications/MAMP/bin/php/php5.4.10/share/pear"
CodeSniffer will be easier to use if you add a symlink for this executable as well.
sudo ln -s /Applications/MAMP/bin/php/php5.4.10/bin/phpcs /usr/bin/phpcs.
You can test your installation by typing
phpcs --version
Customizing for Drupal
The final step is to make the Drupal standard available to codesniffer. The Standard can be downloaded here ftp.drupal.org/files/projects/drupalcs-7.x-1.x-dev.tar.gz . Uncompress the folder and place it with the default Standards supplied by CodeSniffer. To find this directory navigate to the directory identified by running ‘pear config-get php_dir’, then navigate down to PHP/CodeSniffer/Standards. On the current MAMP setup this is /Applications/MAMP/bin/php/php5.4.10/share/pear/PHP/CodeSniffer/Standards
You may be looking for the islandora-community wiki · new to islandora? · community calendar · interest groups