Class: Threat::Plugins::Todo
- Inherits:
-
Danger::Plugin
- Object
- Danger::Plugin
- Threat::Plugins::Todo
- Defined in:
- lib/threat/plugins/todo.rb
Overview
This plugin searches for TODO comments in the codebase
TODO: May be improved by posting different messages for cases when TODO was just introduced in current diff and when contributor just touched a file with existing TODO
Usage:
Dangerfile
“‘ruby danger.import_dangerfile(gem: ’threat’)
todo.run! “‘
Constant Summary collapse
- SUPPORTED_COMMENTS =
[ '#', # e.g Ruby/YAML/Dockerfile and so on '//' # e.g JS ].freeze
- TODO_COMMENENT_REGEX =
/(^|\s)(#{SUPPORTED_COMMENTS.join('|')})\sTODO:\s/
Instance Method Summary collapse
Instance Method Details
#run! ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/threat/plugins/todo.rb', line 25 def run! (git.modified_files + git.added_files).each do |path| File.foreach(path) do |line| next unless line.match?(TODO_COMMENENT_REGEX) warn('TODO detected! The whole team will be greatful if you may resolve it <3') end end end |