You are here

function do_coder_review_grep_invert in Coder 7.2

Same name and namespace in other branches
  1. 5.2 coder.module \do_coder_review_grep_invert()
  2. 5 coder.module \do_coder_review_grep_invert()
  3. 6.2 coder.module \do_coder_review_grep_invert()
  4. 6 coder.module \do_coder_review_grep_invert()
  5. 7 coder_review/coder_review.module \do_coder_review_grep_invert()

Performs a 'grep_invert' type of coder_review.

This type of do_coder_review_* searches for the absence of the occurance of a string.

Parameters

array $coder_args: A Coder settings array, passed by reference. See do_coder_review() for format.

array $review: Review array the current rule belongs to, used by _coder_review_severity_name().

array $rule: Rule array being checked.

array $lines: Pertinent source file lines according to rule's '#source' value.

array $results: Results array variable to save errors to, passed by reference.

See also

do_coder_review()

_coder_review_severity_name()

1 call to do_coder_review_grep_invert()
do_coder_review in coder_review/coder_review.common.inc
Performs a code review for a review array.

File

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

Code

function do_coder_review_grep_invert(array &$coder_args, array $review, array $rule, array $lines, array &$results) {
  if (isset($rule['#value'])) {
    foreach ($lines as $lineno => $line_array) {
      foreach ($line_array as $line) {
        if (_coder_review_search_string($line, $rule)) {
          return;
        }
      }
    }
    $severity_name = _coder_review_severity_name($coder_args, $review, $rule);
    _coder_review_error($results, $rule, $severity_name);
  }
}