You are here

function _coder_error in Coder 6.2

Same name and namespace in other branches
  1. 5.2 coder.module \_coder_error()
  2. 5 coder.module \_coder_error()
  3. 6 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.

8 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().

... See full list

File

./coder.module, line 1707

Code

function _coder_error(&$results, $rule, $severity_name, $lineno = -1, $line = '', $ignores = array()) {

  // 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;

  // Skip warnings we've been told to ignore.
  if (is_array($ignores) && in_array($lineno, $ignores)) {
    $results['#stats']['ignored']++;
  }
  else {
    $key = ($lineno + 1) * 10000 + $_coder_errno++;
    $results[$key] = array(
      'rule' => $rule,
      'severity_name' => $severity_name,
      'lineno' => $lineno,
      'line' => $line,
    );
    $results['#stats'][$severity_name]++;
  }
}