You are here

function _coder_severity_name in Coder 6.2

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

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

... See full list

File

./coder.module, line 1500

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']) && drupal_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';
}