Class: GetIgnoredViolation

Inherits:
Object
  • Object
show all
Defined in:
lib/danger/request_sources/support/get_ignored_violation.rb

Constant Summary collapse

IGNORE_REGEXP =
/>*\s*danger\s*:\s*ignore\s*"(?<error>[^"]*)"/i.freeze

Instance Method Summary collapse

Constructor Details

#initialize(body) ⇒ GetIgnoredViolation

Returns a new instance of GetIgnoredViolation.



4
5
6
# File 'lib/danger/request_sources/support/get_ignored_violation.rb', line 4

def initialize(body)
  @body = body
end

Instance Method Details

#callObject



8
9
10
11
12
# File 'lib/danger/request_sources/support/get_ignored_violation.rb', line 8

def call
  return [] unless body

  body.chomp.scan(IGNORE_REGEXP).flatten
end