'#source' => 'all',
'#type' => 'callback',
'#value' => '_coder_doxygen_function_one_line_summary',
'#warning_callback' => '_coder_doxygen_function_one_line_summary_warning',
),
/**
* The first line of a function Doxygen should be a brief summary.
* and this should fail miserably.
*/
function _coder_doxygen_function_one_line_summary(&$coder_args, $review, $rule, $lines, &$results) {
foreach ($lines as $line_number => $line) {
$first_line_exists = $second_line_is_ok = 0;
// check the next line to see if there's SOMETHING written.
if (preg_match('/^ \* (\w+)/',
$lines[$line_number +
1])) {
$first_line_exists = $line_number + 1; // used in _coder_error().
}
// and check the line after that for either a blank line or end.
if ($first_line_exists &&
preg_match('/^( \*\/| \*\/)$/',
$lines[$line_number +
2])) {
$second_line_is_ok = 1;
}
}
if (!$second_line_is_ok) { // we use $first_line_exists, not $line_number, to refer to start of doxygen.
_coder_error($results, $rule, _coder_severity_name($coder_args, $review, $rule), $first_line_exists);
$first_line_exists = $second_line_is_ok = 0;
}
}
}
}
function _coder_doxygen_function_one_line_summary_warning() {
'#warning' =>
t('Function summaries should be one line only.'),
'#link' => 'http://drupal.org/node/1354',
);
}