class Danger::DangerfileMessagingPlugin

def self.instance_name

Returns:
  • (String) -
def self.instance_name
  "messaging"
end

def fail(*failures, **options)

Returns:
  • (void) -

Parameters:
  • line (String) --
  • file (String) --
  • sticky (Boolean) --
  • message (String, Array) --
def fail(*failures, **options)
  sticky = options.fetch(:sticky, false)
  file = options.fetch(:file, nil)
  line = options.fetch(:line, nil)
  failures.flatten.each do |failure|
    next if should_ignore_violation(failure)
    @errors << Violation.new(failure, sticky, file, line, type: :error) if failure
  end
end

def initialize(dangerfile)

def initialize(dangerfile)
  super(dangerfile)
  @warnings = []
  @errors = []
  @messages = []
  @markdowns = []
end

def markdown(*markdowns, **options)

Returns:
  • (void) -

Parameters:
  • line (String) --
  • file (String) --
  • message (String, Array) --
def markdown(*markdowns, **options)
  file = options.fetch(:file, nil)
  line = options.fetch(:line, nil)
  markdowns.flatten.each do |markdown|
    @markdowns << Markdown.new(markdown, file, line)
  end
end

def message(*messages, **options)

Returns:
  • (void) -

Parameters:
  • line (String) --
  • file (String) --
  • sticky (Boolean) --
  • message (String, Array) --
def message(*messages, **options)
  sticky = options.fetch(:sticky, false)
  file = options.fetch(:file, nil)
  line = options.fetch(:line, nil)
  messages.flatten.each do |message|
    @messages << Violation.new(message, sticky, file, line, type: :message) if message
  end
end

def should_ignore_violation(message)

def should_ignore_violation(message)
  env.request_source.ignored_violations.include? message
end

def status_report

Returns:
  • (Hash) -
def status_report
  {
    errors: @errors.map(&:message).clone.freeze,
    warnings: @warnings.map(&:message).clone.freeze,
    messages: @messages.map(&:message).clone.freeze,
    markdowns: @markdowns.clone.freeze
  }
end

def violation_report

Returns:
  • (Hash) -
def violation_report
  {
    errors: @errors.clone.freeze,
    warnings: @warnings.clone.freeze,
    messages: @messages.clone.freeze
  }
end

def warn(*warnings, **options)

Returns:
  • (void) -

Parameters:
  • line (String) --
  • file (String) --
  • sticky (Boolean) --
  • message (String, Array) --
def warn(*warnings, **options)
  sticky = options.fetch(:sticky, false)
  file = options.fetch(:file, nil)
  line = options.fetch(:line, nil)
  warnings.flatten.each do |warning|
    next if should_ignore_violation(warning)
    @warnings << Violation.new(warning, sticky, file, line, type: :warning) if warning
  end
end