Module: QuietQuality::Annotators

Defined in:
lib/quiet_quality/annotators.rb,
lib/quiet_quality/annotators.rb,
lib/quiet_quality/annotators/github_stdout.rb

Defined Under Namespace

Classes: GithubStdout

Constant Summary collapse

Unrecognized =
Class.new(Error)
ANNOTATOR_TYPES =
{
  github_stdout: Annotators::GithubStdout
}.freeze

Class Method Summary collapse

Class Method Details

.annotate!(annotator:, messages:, limit: nil) ⇒ Object



16
17
18
19
20
21
# File 'lib/quiet_quality/annotators.rb', line 16

def self.annotate!(annotator:, messages:, limit: nil)
  limited_messages = limit ? messages.first(limit) : messages
  ANNOTATOR_TYPES.fetch(annotator.to_sym).new.annotate!(limited_messages)
rescue KeyError
  fail Unrecognized, "Unrecognized annotator_type '#{annotator}'"
end