Class: Danger::DangerfileMessagingPlugin
- Defined in:
- lib/danger/danger_core/plugins/dangerfile_messaging_plugin.rb
Core collapse
-
#fail(message, sticky: true) ⇒ Object
Declares a CI blocking error.
-
#markdown(message) ⇒ Object
Print markdown to below the table.
-
#message(message, sticky: true) ⇒ Object
Print out a generate message on the PR.
- #status_report ⇒ Object
- #violation_report ⇒ Object
-
#warn(message, sticky: true) ⇒ Object
Specifies a problem, but not critical.
Instance Method Summary collapse
-
#initialize(dangerfile) ⇒ DangerfileMessagingPlugin
constructor
A new instance of DangerfileMessagingPlugin.
Methods inherited from Plugin
instance_name, #method_missing
Constructor Details
#initialize(dangerfile) ⇒ DangerfileMessagingPlugin
Returns a new instance of DangerfileMessagingPlugin.
6 7 8 9 10 11 12 13 |
# File 'lib/danger/danger_core/plugins/dangerfile_messaging_plugin.rb', line 6 def initialize(dangerfile) super(dangerfile) @warnings = [] @errors = [] = [] @markdowns = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Danger::Plugin
Instance Method Details
#fail(message, sticky: true) ⇒ Object
Declares a CI blocking error
58 59 60 61 62 |
# File 'lib/danger/danger_core/plugins/dangerfile_messaging_plugin.rb', line 58 def fail(, sticky: true) return if should_ignore_violation() @errors << Violation.new(, sticky) puts "Raising error '#{message}'" end |
#markdown(message) ⇒ Object
Print markdown to below the table
20 21 22 23 |
# File 'lib/danger/danger_core/plugins/dangerfile_messaging_plugin.rb', line 20 def markdown() @markdowns << puts "Printing markdown #{message}" end |
#message(message, sticky: true) ⇒ Object
Print out a generate message on the PR
32 33 34 35 |
# File 'lib/danger/danger_core/plugins/dangerfile_messaging_plugin.rb', line 32 def (, sticky: true) << Violation.new(, sticky) puts "Printing message '#{message}'" end |
#status_report ⇒ Object
64 65 66 67 68 69 70 71 |
# File 'lib/danger/danger_core/plugins/dangerfile_messaging_plugin.rb', line 64 def status_report { errors: @errors.map(&:message).clone.freeze, warnings: @warnings.map(&:message).clone.freeze, messages: .map(&:message).clone.freeze, markdowns: @markdowns.clone.freeze } end |
#violation_report ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/danger/danger_core/plugins/dangerfile_messaging_plugin.rb', line 73 def violation_report { errors: @errors.clone.freeze, warnings: @warnings.clone.freeze, messages: .clone.freeze } end |
#warn(message, sticky: true) ⇒ Object
Specifies a problem, but not critical
44 45 46 47 48 |
# File 'lib/danger/danger_core/plugins/dangerfile_messaging_plugin.rb', line 44 def warn(, sticky: true) return if should_ignore_violation() @warnings << Violation.new(, sticky) puts "Printing warning '#{message}'" end |