Class: RuboCop::Cop::Obsession::NoTodos
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Obsession::NoTodos
- Defined in:
- lib/rubocop/cop/obsession/no_todos.rb
Overview
This cop checks for TODO/FIXME/etc comments.
Avoid TODO comments, instead create tasks for them in your project management software, and assign them to the right person. Half of the TODOs usually never get done, and the code is then polluted with old stale TODOs. Sometimes developers really mean to work on their TODOs soon, but then Product re-prioritizes their work, or the developer leaves the company, and never gets a chance to tackle them.
Constant Summary collapse
- MSG =
'Avoid TODO comment, create a task in your project management tool instead.'
- KEYWORD_REGEX =
/(^|[^\w])(TODO|FIXME|OPTIMIZE|HACK)($|[^\w])/i
Instance Method Summary collapse
Instance Method Details
#on_new_investigation ⇒ Object
18 19 20 21 22 |
# File 'lib/rubocop/cop/obsession/no_todos.rb', line 18 def on_new_investigation processed_source.comments.each do |comment| add_offense(comment) if comment.text.match?(KEYWORD_REGEX) end end |