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.



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

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

Instance Method Details

#run(sys, postman, opts) ⇒ Object



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

def run(sys, postman, opts)
  Requires.new(__dir__).load
  opts[:rules] = opts.construct("rules")
  opts[:total] = opts[:rules].sum(&:score)
  opts[:tickets] = sys.issues(opts["jql"], opts.jira_defaults)
                      .map { |i| Score.new(i, opts) }
                      .each(&:evaluate)
                      .each(&:post)
  postman.send(opts) unless opts[:tickets].empty?
end