Class: Lazylead::LogsLink

Inherits:
Logs show all
Defined in:
lib/lazylead/task/accuracy/logs_link.rb

Overview

Check that ticket has link/reference to log record(s) in another system like ELK, GrayLog, etc.

or attachment with plain log file

Instance Attribute Summary

Attributes inherited from Requirement

#desc, #field, #score

Instance Method Summary collapse

Methods inherited from Logs

#matches?

Methods inherited from Attachment

#matches?

Methods inherited from Requirement

#blank?, #non_blank?

Constructor Details

#initialize(link) ⇒ LogsLink

Returns a new instance of LogsLink.



32
33
34
35
# File 'lib/lazylead/task/accuracy/logs_link.rb', line 32

def initialize(link)
  super
  @link = link
end

Instance Method Details

#link?(issue) ⇒ Boolean

Ensure that ticket has a link to external logs system like ELK, GrayLog, etc.

Returns:

  • (Boolean)


42
43
44
45
46
47
48
49
50
# File 'lib/lazylead/task/accuracy/logs_link.rb', line 42

def link?(issue)
  return false if issue.description.nil?
  issue.description
       .split("\n")
       .reject(&:blank?)
       .flat_map(&:split)
       .reject(&:blank?)
       .any? { |word| word.start_with? @link }
end

#passed(issue) ⇒ Object



37
38
39
# File 'lib/lazylead/task/accuracy/logs_link.rb', line 37

def passed(issue)
  super(issue) || link?(issue)
end