You are here

function theme_drush_coder_warning in Coder 6.2

Same name and namespace in other branches
  1. 5.2 coder.drush.inc \theme_drush_coder_warning()
  2. 6 coder.drush.inc \theme_drush_coder_warning()
1 call to theme_drush_coder_warning()
theme_coder_warning in ./coder.module
Format a coder warning to be included in results.

File

./coder.drush.inc, line 196
Command line utility for coder.

Code

function theme_drush_coder_warning($warning, $severity_name, $lineno = 0, $line = '') {
  $checkstyle_levels = array(
    'minor' => 'info',
    'normal' => 'warning',
    'critical' => 'error',
  );
  if (_coder_drush_is_option('xml') || _coder_drush_is_option('checkstyle')) {
    $attr = array(
      'line' => $lineno,
      'column' => 0,
      'severity' => $severity_name,
      'message' => $warning,
      'source' => $line,
    );
    if (_coder_drush_is_option('checkstyle')) {
      $attr['severity'] = $checkstyle_levels[$severity_name];
    }
    $output = '<error ' . drupal_attributes($attr) . ' />';
    return $output;
  }
  else {
    $output = $lineno ? '+' . $lineno . ': ' : '';
    $output .= '[' . $severity_name . '] ';
    $output .= is_array($warning) ? $warning['#warning'] : $warning;
    return _coder_drush_output($output);
  }
}