Class: Lazylead::Task::Accuracy

Inherits:
Object
  • Object
show all
Defined in:
lib/lazylead/task/accuracy/accuracy.rb

Overview

Evaluate ticket format and accuracy

The task supports the following features:

- fetch issues from remote ticketing system by query
- evaluate each field within the ticket
- post the score to the ticket

Instance Method Summary collapse

Constructor Details

#initialize(log = Log.new) ⇒ Accuracy

Returns a new instance of Accuracy.



43
44
45
# File 'lib/lazylead/task/accuracy/accuracy.rb', line 43

def initialize(log = Log.new)
  @log = log
end

Instance Method Details

#init_rules(opts) ⇒ Object

Initialize accuracy rules and configuration for tickets verification.



58
59
60
61
62
63
# File 'lib/lazylead/task/accuracy/accuracy.rb', line 58

def init_rules(opts)
  Requires.new(__dir__).load
  opts[:rules] = opts.construct("rules")
  opts[:total] = opts[:rules].sum(&:score)
  opts[:memes] = Memes.new(opts["memes"])
end

#run(sys, postman, opts) ⇒ Object



47
48
49
50
51
52
53
54
55
# File 'lib/lazylead/task/accuracy/accuracy.rb', line 47

def run(sys, postman, opts)
  init_rules(opts)
  opts[:tickets] = sys.issues(opts["jql"], opts.jira_defaults.merge(expand: "changelog"))
                      .map { |i| Score.new(i, opts) }
                      .each(&:evaluate)
                      .each(&:post)
  postman.send(opts) unless opts[:tickets].empty?
  opts
end