Class: Danger::DangerTodoist
- Inherits:
-
Plugin
- Object
- Plugin
- Danger::DangerTodoist
- Defined in:
- lib/todoist/plugin.rb
Overview
This is a danger plugin to detect any TODO/FIXME entries left in the code.
Constant Summary collapse
- DEFAULT_MESSAGE =
"There remain todo items in the modified code.".freeze
- DEFAULT_KEYWORDS =
%w(TODO FIXME).freeze
Instance Attribute Summary collapse
-
#keywords ⇒ void
writeonly
Keywords to recognize as todos.
-
#message ⇒ void
writeonly
Message to be shown.
Instance Method Summary collapse
-
#fail_for_todos ⇒ void
Adds an error if there are todos found in the modified code.
-
#print_todos_table ⇒ void
Adds a list of offending files to the danger comment.
-
#todos ⇒ Array of todos
Returns the list of todos in the current diff set.
-
#warn_for_todos ⇒ void
Adds a warning if there are todos found in the modified code.
Instance Attribute Details
#keywords=(value) ⇒ void
This method returns an undefined value.
Keywords to recognize as todos
47 48 49 |
# File 'lib/todoist/plugin.rb', line 47 def keywords=(value) @keywords = value end |
#message=(value) ⇒ void
This method returns an undefined value.
Message to be shown
40 41 42 |
# File 'lib/todoist/plugin.rb', line 40 def (value) @message = value end |
Instance Method Details
#fail_for_todos ⇒ void
This method returns an undefined value.
Adds an error if there are todos found in the modified code
63 64 65 |
# File 'lib/todoist/plugin.rb', line 63 def fail_for_todos call_method_for_todos(:fail) end |
#print_todos_table ⇒ void
This method returns an undefined value.
Adds a list of offending files to the danger comment
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/todoist/plugin.rb', line 72 def print_todos_table find_todos if @todos.nil? return if @todos.empty? markdown("#### Todos left in files") @todos .group_by(&:file) .each { |file, todos| print_todos_per_file(file, todos) } end |
#todos ⇒ Array of todos
Returns the list of todos in the current diff set
88 89 90 91 |
# File 'lib/todoist/plugin.rb', line 88 def todos find_todos if @todos.nil? @todos end |
#warn_for_todos ⇒ void
This method returns an undefined value.
Adds a warning if there are todos found in the modified code
54 55 56 |
# File 'lib/todoist/plugin.rb', line 54 def warn_for_todos call_method_for_todos(:warn) end |