Implicitly assigning users on TODO
Catana introduces a new feature to allow developers to write TODO without explicitly assigning a user. This feature is turned off by default, and each project can opt-in by modifying the setting on the Catana dashboard.
We’ll see in this blog post how it works and what’s different between explicit and implicit assignment.
Explicit by default
By default, Catana enforces TODOs to have an explicit assignee. A user is assignable on a TODO using the
to: keyword and accepts a GitHub login as a value.
Explicitly assigning a user allows for easier discoverability. When running into a TODO in a source code file, other developers can quickly identify its author without switching contexts.
Explicitness is a good option for large projects with many contributors but can be cumbersome on projects with a limited number of developers.
Opt-in for implicit assignee
Repositories that opted-in to this feature allows developers to write a TODO without explicitly writing who is assigned to it.
When such TODOs are introduced in your codebase, Catana will infer the assignee based on the commit authorship.
Let’s take this
git push and the associated
git diff as an example:
Catana will get the author from this
git diff (Edouard Chin), make a request to GitHub to get the associated GitHub login and assign it to the TODO.
Similar but different
As you might have noticed, a TODO that doesn’t have an explicitly assigned user in the source file will still be assigned to its author by Catana. It is a deliberate choice as Catana is strongly opinionated on ownership when introducing TODOs in a codebase.
The choice to opt-in to implicit assignee boils down to convenience and less typing when writing a TODO.
Catana gets its data from
git diff. A
diff doesn’t have the concept of “updating a line”, therefore when moving an existing TODO to a different line in a file, Catana determines whether a TODO needs to be updated based on a set of conventions.
Consider the following changes where a user moves a TODO to a different line:
Based on the conventions mentioned above, Catana will not update the existing TODO but will delete it and create a new one. Catana will assign the newly created TODO to whoever authored the commit (in this case, “Bob”).
To avoid this behavior, always add a title to your TODO, as it helps Catana determine when to update a TODO and when not.