Module: ArchSpec::Evaluator

Extended by:
Evaluator
Included in:
Evaluator
Defined in:
lib/archspec/evaluator.rb

Instance Method Summary collapse

Instance Method Details

#evaluate(definition, graph, todo: Todo.empty) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/archspec/evaluator.rb', line 7

def evaluate(definition, graph, todo: Todo.empty)
  diagnostics = parser_diagnostics(graph) + definition.rules.flat_map { |rule| rule.evaluate(graph) }

  diagnostics
    .reject { |diagnostic| graph.suppressed?(diagnostic) || todo.include?(diagnostic) }
    .sort_by { |d| [d.location.path, d.location.line, d.rule, d.message, d.evidence] }
    .uniq { |d| [d.rule, d.message, d.location.path, d.location.line] }
end