function _coder_severity_name in Coder 5.2
Same name and namespace in other branches
- 5 coder.module \_coder_severity_name()
- 6.2 coder.module \_coder_severity_name()
- 6 coder.module \_coder_severity_name()
Return string severity for a given error.
Parameters
$coder_args: Coder settings array, see do_coder_reviews().
$review: Review array, see hook_reviews(), contains rule arrays.
$rule: Rule array that was triggered, see individual entries from hook_reviews().
Return value
String severity of error.
6 calls to _coder_severity_name()
- do_coder_review_grep in ./
coder.module - Search for a string.
- do_coder_review_grep_invert in ./
coder.module - Search for potentially missing string.
- do_coder_review_regex in ./
coder.module - Implements do_coder_review_* for regex match.
- _coder_50_callback in includes/
coder_50.inc - Define the rule callbacks for 5.x, see do_coder_review_callback().
- _coder_6x_callback in includes/
coder_6x.inc - Define the rule callbacks for 6.x, see do_coder_review_callback().
File
- ./
coder.module, line 1157 - 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 _coder_severity_name($coder_args, $review, $rule) {
// NOTE: Warnings in php includes are suspicious because
// php includes are frequently 3rd party products.
if (isset($coder_args['#php_minor']) && substr($coder_args['#filename'], -4) == '.php') {
return 'minor';
}
// Get the severity as defined by the rule.
if (isset($rule['#severity'])) {
return $rule['#severity'];
}
// If it's not defined in the rule, then it can be defined by the review.
if (isset($review['#severity'])) {
return $review['#severity'];
}
// Use the default.
return 'normal';
}