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
Instance Attribute Summary collapse
-
#message ⇒ void
writeonly
Message to be shown.
Instance Method Summary collapse
-
#print_todos_table ⇒ void
Adds a list of offending files to the danger comment.
-
#warn_for_todos ⇒ void
Adds a warning if there are todos found in the modified code.
Instance Attribute Details
#message=(value) ⇒ void
This method returns an undefined value.
Message to be shown
31 32 33 |
# File 'lib/todoist/plugin.rb', line 31 def (value) @message = value end |
Instance Method Details
#print_todos_table ⇒ void
This method returns an undefined value.
Adds a list of offending files to the danger comment
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/todoist/plugin.rb', line 52 def print_todos_table return if @todos.nil? return if @todos.empty? markdown("#### Todos left in files") @todos.each do |todo| text = ": #{todo.text}" if todo.text markdown("- #{todo.file}#{text}") end end |
#warn_for_todos ⇒ void
This method returns an undefined value.
Adds a warning if there are todos found in the modified code
38 39 40 41 42 43 44 45 |
# File 'lib/todoist/plugin.rb', line 38 def warn_for_todos @todos = [] return if files_of_interest.empty? @todos = DiffTodoFinder.new.find_diffs_containing_todos(diffs_of_interest) warn() unless @todos.empty? end |