function _coder_error in Coder 6
Same name and namespace in other branches
- 5.2 coder.module \_coder_error()
- 5 coder.module \_coder_error()
- 6.2 coder.module \_coder_error()
Builds an error message based on the rule that failed and other information.
Parameters
$results: Results array variable to save errors to.
$rule: Rule array that triggered the error.
$severity_name: String severity of error as detected by _coder_severity_name().
$lineno: Line number of error.
$line: Contents of line that triggered error.
$original: Deprecated.
6 calls to _coder_error()
- 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 1513 - 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_error(&$results, $rule, $severity_name, $lineno = -1, $line = '') {
// Note: The use of the $key allows multiple errors on one line.
// This assumes that no line of source has more than 10000 lines of code
// and that we have fewer than 10000 errors.
global $_coder_errno;
$key = ($lineno + 1) * 10000 + $_coder_errno++;
$results[$key] = array(
'rule' => $rule,
'severity_name' => $severity_name,
'lineno' => $lineno,
'line' => $line,
);
$results['#stats'][$severity_name]++;
}