MikaCredoRules.TodosNeedTickets (MikaCredoRules v0.1.0)

Copy Markdown View Source

Every todo comment must reference a ticket URL on the same or an adjacent line.

A todo without a ticket has no owner, no priority and no deadline — it is a wish, not a plan. Every TODO/FIXME comment must carry a ticket URL on its own line, the line directly above it or the line directly below it.

# BAD — nothing tracks this
# TODO: make this faster

# BAD — the ticket URL is not adjacent to the todo
# TODO: make this faster
def work, do: :ok
# https://linear.app/company/issue/443

# GOOD — the ticket URL on the same line
# TODO: make this faster, see https://linear.app/company/issue/443

# GOOD — the ticket URL on the next line
# TODO: make this faster
# https://linear.app/company/issue/443

# GOOD — the ticket URL on the previous line
# https://linear.app/company/issue/443
# TODO: make this faster

Doc attributes (@doc, @moduledoc, @shortdoc) that start with a tag word are flagged too. Line adjacency means nothing inside a doc string, so a doc todo passes when the same doc string contains a ticket URL anywhere.

By default any http:// or https:// URL counts as a ticket reference. Set the :ticket_url param to your tracker's URL prefix so only real tickets count:

{MikaCredoRules.TodosNeedTickets, ticket_url: "https://linear.app/company/issue/"}