Skip to content
Jim Graham edited this page May 30, 2024 · 7 revisions

Syntax

SmartTodo uses a syntax derived from the regular TODO comment in order to not break existing tools (IDE, code coverage ...)

# TODO(on: date('2019-01-18'), to: '[email protected]')
#   This is a comment associated with the TODO.

A SmartTodo starts with the keyword TODO followed by (), just like regular ruby method calls (in fact SmartTodo expects a valid ruby syntax). Inside the parenthesis, SmartTodo expects two keywords, on and to.

on

The on keyword is used to define the event associated with this TODO task. Events are what makes your TODO to expire and be reminded about it. SmartTodo has few built-in useful events, you can check out the list here.

You can define multiple events for your TODO. In such case, if any of the event is met, your TODO will be considered as expired. To define multiple events you simply have to add more on keywords.

# TODO(on: date('2019-01-18'), on: gem_release('rails', 'rails', 54251),  to: '[email protected]')
#   This is a comment associated with the TODO.

to

The to keyword is to assign a user to the TODO. It expects either the full email address of the Slack user, or a Slack channel. You can't provide the nickname of the Slack user.

# TODO(on: date('2019-01-18'), to: '[email protected]')
#   Associated comment

# TODO(on: date('2019-01-18'), to: '#general')
#   Associated comment

The to keyword can also be used multiple times in the same TODO to send notifications to multiple Slack channels or users:

# TODO(on: date('2019-01-18'), to: '[email protected]', to: '[email protected]', to: '#general')
#   Associated comment

Associated comment

It's not required but it's a good practice to add an associated comment as part of the TODO. It helps to get the context of why this TODO was written. The comment will be sent alongs the Slack message.

To add a comment as part of your TODO, it has to be indented 2 spaces below the TODO() declaration. You can add as many comment lines as you want as long as they are indented.

# TODO(on: date('2019-01-18'), to: '[email protected]')
#   Associated comment
#   Another comment
#   And another one ...
Clone this wiki locally