Class: Danger::DangerLgtm

Inherits:
Plugin
  • Object
show all
Includes:
Lgtm::Network
Defined in:
lib/lgtm/plugin.rb

Overview

Lgtm let danger say lgtm when there is no violations. Default use random lgtm image from [lgtm.in](lgtm.in).

Examples:

Post lgtm with a specific image


lgtm.check_lgtm image_url: 'http://some.iamge'

See Also:

  • leonhartX/danger-lgtm

Constant Summary collapse

LGTM_URL =
'https://www.lgtm.app'.freeze
RANDOM_POST_PATH =
'/g/'.freeze
POST_CONTENT_PATH =
'/p/'.freeze

Instance Method Summary collapse

Methods included from Lgtm::Network

#parse_redirect_location, #process_request

Instance Method Details

#check_lgtm(image_url: nil, https_image_only: false) ⇒ nil

check_lgtm Comment LGTM markdown if report has no violations

Parameters:

  • image_url (String) (defaults to: nil)

    LGTM image url

  • https_image_only (Boolean) (defaults to: false)

    Use only secure url

Returns:

  • (nil)


34
35
36
37
38
39
40
41
42
43
# File 'lib/lgtm/plugin.rb', line 34

def check_lgtm(image_url: nil, https_image_only: false)
  return if status_report[:errors].any?
  return if status_report[:warnings].any?

  if image_url
    comment image_url
  else
    comment fetch_image_url(https_image_only)
  end
end