diff -up ./coder.drush.inc ../../developer/coder_hacked//coder.drush.inc
--- ./coder.drush.inc	2009-10-18 15:05:58.000000000 +0200
+++ ../../developer/coder_hacked//coder.drush.inc	2010-10-23 17:43:30.552601998 +0200
@@ -10,6 +10,19 @@ function coder_drush_command() {
     'description' => dt('Run code reviews'),
     'drupal dependencies' => array('coder'),
   );
+
+  $items['coder-checkstyle'] = array(
+    'description' => dt('Run a code review and output in checkstyle xml format.'),
+    'drupal dependencies' => array('coder'),
+    'options' => array(
+      '--reviews' => 'Comma separated list of coder reviews to run. Defaults to "recommended", which is an alias for style,comment,sql,security,i18n',
+      '--severity' => 'One of "minor", "normal" or "critical". Defaults to minor.',
+    ),
+    'arguments' => array(
+      'project' => 'The drupal project to be checked.',
+    ),
+  );
+
   return $items;
 }
 
@@ -148,3 +161,114 @@ function _coder_drush_is_option($option)
   global $_coder_drush_options;
   return isset($_coder_drush_options[$option]);
 }
+
+/**
+ * Implementation of drush_hook_coder_checkstyle().
+ */
+function drush_coder_checkstyle($project = NULL) {
+  if (empty($project)) {
+    drush_set_error('coder-checkstyle-no-project', dt('You must specify a comma separated list of projects.'));
+    return;
+  }
+  
+  //covert comma separated list of projects
+  //into array
+  $projects = explode(',', $project);
+  
+  foreach ($projects as $project) {
+    if (!($path = drupal_get_path('module', $project)) &&
+        !($path = drupal_get_path('theme', $project))) {
+      drush_set_error('coder-checkstyle-invalid-project', dt('Could not find a project by the name of !project', array('!project' => $project)));
+      return;
+    }
+    else {
+      //add module/theme path to list of scanned paths.
+      $paths[] = $path;
+    }
+  }
+
+  $reviews = drush_get_option('reviews', 'recommended');
+  if ($reviews == 'recommended') {
+    $reviews = 'style,comment,sql,security,i18n';
+  }
+  $reviews = array_map('trim', explode(',', $reviews));
+  $severity = _coder_severity(drush_get_option('severity', 'minor'), SEVERITY_MINOR);
+
+  $all_results = array();
+  foreach ($paths as $path) {
+    foreach ($reviews as $review) {
+      drush_log(dt('Running coder review for !review', array('!review' => $review)));
+      $results = _coder_drush_run_review($path, $review);
+      if ($results) {
+        $all_results = array_merge_recursive($all_results, $results); 
+      }
+    }
+  }
+
+  drush_print(_coder_drush_output_checkstyle($all_results));
+}
+
+/**
+ * Run a single coder review against a single module or theme path.
+ */
+function _coder_drush_run_review($path, $review_name, $severity = SEVERITY_MINOR) {
+  $reviews = coder_reviews();
+  if (!isset($reviews[$review_name])) {
+    drush_log(dt('!review_name is not a valid review. Available reviews are !reviews.', array('!review_name' => $review_name, '!reviews' => join(', ', array_keys($reviews)))), 'warning');
+    return FALSE;
+  }
+
+  $ext = variable_get('coder_php_ext', array('inc', 'php', 'install', 'test'));
+  $mask = '(\.'. implode('|\.', $ext) .')';
+
+  $files = file_scan_directory($path, $mask);
+
+  foreach ($files as $file) {
+    $filename = $file->filename;
+    $coder_args = array(
+      '#severity' => $severity,
+      '#filename' => $filename,
+      '#php_extensions' => $ext,
+      '#include_extensions' => _coder_get_reviews_extensions($ext, $reviews),
+    );
+    _coder_read_and_parse_file($coder_args);
+    $results[$filename] = do_coder_review($coder_args, $reviews[$review_name]);
+    unset($results[$filename]['#stats']);
+  }
+  return $results;
+}
+
+/**
+ * Export results from _coder_drush_run_review in checkstyle xml format.
+ */
+function _coder_drush_output_checkstyle($results) {
+  $output = '<?xml version="1.0" encoding="UTF-8"?>'. "\n";
+  $output .= '<checkstyle version="1.3.0RC1">'. "\n";
+  foreach ($results as $file => $checks) {
+    $file = realpath($file);
+    if (empty($checks)) {
+      $output .= '<file name="'. $file .'"/>'. "\n";
+    }
+    else {
+      $output .= '<file name="'. $file .'">'. "\n";
+      foreach ($checks as $id => $result) {
+        $warning = _coder_warning($result['rule']);
+        if (is_array($warning)) {
+          $warning = $warning['#warning'];
+        }
+
+        $attr = array(
+          'line' => $result['lineno'],
+          'column' => 0,
+          'severity' => $result['severity_name'],
+          'message' => $warning,
+          'source' => $result['rule']['#source'],
+        );
+        $output .= '<error '. drupal_attributes($attr) .'/>'. "\n";
+      }
+      $output .= '</file>'. "\n";
+    }
+  }
+  $output .= '</checkstyle>'. "\n";
+  return $output;
+}
