You are here

function _coder_review_severity_name in Coder 7.2

Same name and namespace in other branches
  1. 7 coder_review/coder_review.module \_coder_review_severity_name()

Return string severity for a given error.

Parameters

array $coder_args: A Coder settings array. See do_coder_reviews() for format information.

array $review: Review array that contains rule arrays. See hook_reviews() for details.

array $rule: Rule array that was triggered. See individual entries from hook_reviews().

Return value

string A string describing the severity of the error.

See also

do_coder_reviews()

hook_review()

16 calls to _coder_review_severity_name()
do_coder_review_grep in coder_review/coder_review.common.inc
Performs a 'grep' type of coder_review.
do_coder_review_grep_invert in coder_review/coder_review.common.inc
Performs a 'grep_invert' type of coder_review.
do_coder_review_regex in coder_review/coder_review.common.inc
Performs a 'regex' type of coder_review.
_coder_review_5x_callback in coder_review/includes/coder_review_5x.inc
Define the rule callbacks for 5.x, see do_coder_review_review_callback().
_coder_review_6x_callback in coder_review/includes/coder_review_6x.inc
Define the rule callbacks for 6.x, see do_coder_review_callback().

... See full list

File

coder_review/coder_review.common.inc, line 886
Common functions used by both the drush and form interfaces.

Code

function _coder_review_severity_name(array $coder_args, array $review, array $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';
}