Skip to content

Instantly share code, notes, and snippets.

@msonnabaum
Created November 15, 2011 23:19
Show Gist options
  • Save msonnabaum/1368705 to your computer and use it in GitHub Desktop.
Save msonnabaum/1368705 to your computer and use it in GitHub Desktop.
<?php
/**
* Implementation of hook_drush_command().
*/
function code_sniffer_drush_command() {
$items['code-sniff'] = array(
'description' => '',
'arguments' => array(
'file' => "The file to run code-sniffer on.",
),
'options' => array(
),
'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
);
return $items;
}
function drush_code_sniffer_code_sniff($file) {
$drupalcs_path = dirname(__FILE__) . '/drupalcs/ruleset.xml';
$cmd = "phpcs --standard=%s %s";
drush_shell_exec($cmd, $drupalcs_path, $file);
$output = drush_shell_exec_output();
drush_print(implode("\n", $output));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment