function do_coder_review in Coder 5
Same name and namespace in other branches
- 5.2 coder.module \do_coder_review()
- 6.2 coder.module \do_coder_review()
- 6 coder.module \do_coder_review()
- 7.2 coder_review/coder_review.common.inc \do_coder_review()
- 7 coder_review/coder_review.module \do_coder_review()
1 call to do_coder_review()
File
- ./
coder.module, line 976 - Developer Module that assists with code review and version upgrade that supports a plug-in extensible hook system so contributed modules can define additional review standards.
Code
function do_coder_review($coder_args, $review) {
$results = array();
if ($review['#rules']) {
// get the review's severity, used when the rule severity is not defined
$default_severity = _coder_severity($review['#severity']);
foreach ($review['#rules'] as $rule) {
// perform the review if above the user requested severity
$severity = _coder_severity(isset($rule['#severity']) ? $rule['#severity'] : '', $default_severity);
if ($severity >= $coder_args['#severity']) {
if (isset($rule['#original'])) {
// deprecated
$lines = $coder_args['#all_lines'];
}
elseif (isset($rule['#source'])) {
// all, html, comment, or php
$source = '#' . $rule['#source'] . '_lines';
$lines = $coder_args[$source];
}
else {
$lines = $coder_args['#php_lines'];
}
if ($lines) {
switch ($rule['#type']) {
case 'regex':
do_coder_review_regex($coder_args, $review, $rule, $lines, $results);
break;
case 'grep':
do_coder_review_grep($coder_args, $review, $rule, $lines, $results);
break;
case 'grep_invert':
do_coder_review_grep_invert($coder_args, $review, $rule, $lines, $results);
break;
case 'callback':
do_coder_review_callback($coder_args, $review, $rule, $lines, $results);
break;
}
}
}
}
}
return $results;
}