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.



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

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

Instance Method Details

#run(sys, postman, opts) ⇒ Object



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

def run(sys, postman, opts)
  Dir[File.join(__dir__, "*.rb")].sort.each { |f| require f }
  rules = opts.slice("rules", ",")
              .map(&:constantize)
              .map(&:new)
  raised = sys.issues(opts["jql"], opts.jira_defaults)
              .map { |i| Score.new(i, opts, rules) }
              .each(&:evaluate)
              .each(&:post)
  postman.send opts.merge(tickets: raised) unless raised.empty?
end