canJudge method

bool canJudge(
  1. String path,
  2. String rule,
  3. Set<int> ruleTargets
)

Whether a comment for rule in path may be judged at all.

ruleTargets are the lines every // ignore: naming rule in that file points at. When a comment hid a finding on any OTHER line, the reporter honored a comment the line-based parser cannot place (e.g. one above a second comment line), so no comment for rule in the file can be safely called stale.

Implementation

bool canJudge(String path, String rule, Set<int> ruleTargets) {
  if (!rulesRun.contains(rule) || _unlocated.contains(rule)) return false;
  final key = staleIgnorePathKey(path);
  if (!_filesWalked.contains(key)) return false;
  if (_failures.contains('$key\n$rule')) return false;
  final hidden = _commentHidden['$key\n$rule'];
  return hidden == null || ruleTargets.containsAll(hidden);
}