Sublime Text 3 integration with Drupal Code Sniffer.
- Install Drupal Coder (https://packagist.org/packages/drupal/coder#user-content-installation)
- Make a note of the install location of phpcs (i.e. /Users/yourusername/.composer/vendor/bin)
- If phpcs was previously installed, uninstall and redo Drupal Coder installation (phpcs comes with it)
- Clone this repo somewhere: `git clone https://github.com/mattwithoos/SublimeText3DrupalCoder
- IMPORTANT Edit DrupalCoder.sublime-build, updating the path /Users/changeme/... to phpcs. You can try
whereis phpcs
orwhich phpcs
if you don't have the path from step 2. - Place the DrupalCoder.sublime-build file into your Packages/User directory. (On OS X this is ~/Library/Application Support/Sublime Text 3/Packages/User)
- Open up Sublime Text 3 and select Tools > Build System > DrupalCodingStandard
- Open any Drupal file and hit Cmd+B (probably CTRL+B on Windows/Linux)
- You can make reporting more compress with "--report=full". In this case sniffer will show only line number(without full path to file)
- To auto fix any file with phpcbf run Cmd+shift+B (probably CTRL+shift+B on Windows/Linux)
Got Sublime Text 2? Credits to sirkitree for the inspiration, some of the readme and code, as well as having a Sublime Text 2 build script. https://github.com/sirkitree/DrupalCodingStandard