Skip to content

Instantly share code, notes, and snippets.

@komlenic
Last active December 23, 2017 08:35
Show Gist options
  • Save komlenic/543b6f5893d129502c97 to your computer and use it in GitHub Desktop.
Save komlenic/543b6f5893d129502c97 to your computer and use it in GitHub Desktop.
Installing drupal code standards in vim + syntastic
# This assumes you already have installed vim, and syntastic (and of course php).
# Download the Drupal coder module. You could do this via other methods but git is nice.
# You can place this wherever, but take note of where you placed it. Something like
# /usr/local/src might be good.
git clone --branch 8.x-2.x http://git.drupal.org/project/coder.git
# Install php code sniffer (phpcs). Using pear.
pear install PHP_CodeSniffer
# Test if phpcs was installed correctly.
phpcs --version
# Tell phpcs where the Drupal coding standards live.
ln -sv /path/to/coder/coder_sniffer/Drupal $(pear config-get php_dir)/PHP/CodeSniffer/Standards
# Add this line to .vimrc.
let g:syntastic_php_phpcs_args = " --standard=Drupal --extensions=php,module,inc,install,test,profile,theme"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment