Class: Danger::DangerLgtm

Inherits:
Plugin
  • Object
show all
Includes:
Lgtm::ErrorHandleable
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

RANDOM_LGTM_POST_URL =
'https://lgtm.in/g'.freeze

Constants included from Lgtm::ErrorHandleable

Lgtm::ErrorHandleable::CLIENT_ERRORS, Lgtm::ErrorHandleable::SERVER_ERRORS

Instance Method Summary collapse

Methods included from Lgtm::ErrorHandleable

#validate_response

Instance Method Details

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

This method returns an undefined value.

Check status report, say lgtm if no violations Generates a ‘markdown` of a lgtm image.

Parameters:

  • image_url (String) (defaults to: nil)

    lgtm image url

  • https_image_only (Boolean) (defaults to: false)

    https image only if true



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

def check_lgtm(image_url: nil, https_image_only: false)
  return unless status_report[:errors].length.zero? &&
                status_report[:warnings].length.zero?

  image_url ||= fetch_image_url(https_image_only: https_image_only)

  markdown(
    markdown_template(image_url)
  )
end