Eliminate the undocumented TODOs with todocheck
Tags: todocheck, productivity, opensource, go
Published: 2020-07-19 17:47:16

---
title: Eliminate the undocumented TODOs with todocheck
published: true
description: A static code analyser for annotated TODO comments
tags: todocheck, productivity, opensource, go
cover_image: https://i0.wp.com/pmihaylov.com/wp-content/uploads/2020/07/todocheck-logo-1.png?w=1098&ssl=1
canonical_url: https://pmihaylov.com/todocheck/
---
<!-- wp:paragraph -->
<p>Yesterday, I released <a href="https://github.com/preslavmihaylov/todocheck">todocheck</a> - a new kind of static code analyser for annotated TODOs.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Way too often, we let leftover TODOs slip into our main branch, which leaves your coworkers puzzles, looking at it a year from now. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>They're thinking - what did I mean by "TODO: Move this to the users package"? What is the users package? It doesn't seem to exist anymore.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><a href="https://github.com/preslavmihaylov/todocheck">todocheck</a> helps you fix this by forcing you to mark all your TODOs against an existing, open issue in your issue tracker.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>That way, if you, at some point, close the issue, thinking you're done, the CI pipeline will sparkle in red as there is an open, unaddressed TODO in your main branch.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>No longer can developers close a half-baked issue, rushing for the weekly sprint review to say "I'm done!".</p>
<!-- /wp:paragraph -->

<!-- wp:more -->
<!--more-->
<!-- /wp:more -->

<!-- wp:heading -->
<h2>How todocheck works</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>You run <a href="https://github.com/preslavmihaylov/todocheck">todocheck</a> as a standalone binary from the root of your project and it looks for issues with the following format:</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>// TODO J123: Fix this typo
func fuu() {
    ...
}</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>In case the linked issue <code>J123</code> is open, <code>todocheck</code> will not report any error. In case you close the issue or it doesn't exist, todocheck will show an error:</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>ERROR: Issue is closed.
myproject/main.go:12: // TODO J123: Fix this typo

ERROR: Issue doesn't exist.
myproject/main.go:14: // TODO J321: A non-existent issue</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>If there is an unannotated <code>TODO</code> in your code base, todocheck will also report it as a malformed <code>TODO</code>:</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>ERROR: Malformed todo.
myproject/main.go:16: // TODO - This is not a valid annotated todo</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>Only&nbsp;<code>TODO</code>s with valid, open issues are allowed to exist in the codebase.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"linkDestination":"custom"} -->
<figure class="wp-block-image"><a href="https://github.com/preslavmihaylov/todocheck/blob/master/images/todocheck-demo.gif" target="_blank" rel="noreferrer noopener"><img src="https://github.com/preslavmihaylov/todocheck/raw/master/images/todocheck-demo.gif" alt="todocheck demo gif"/></a></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>By integrating todocheck in your development workflow &amp; CI pipeline, you can ensure that there will be no half-baked issue closed with pending <code>TODO</code>s in the codebase.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Does todocheck work with my language?</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>You can see the list of supported programming languages <a href="https://github.com/preslavmihaylov/todocheck#supported-programming-languages">here</a>.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>There is also support for various public &amp; private issue trackers. See the list <a href="https://github.com/preslavmihaylov/todocheck#supported-issue-trackers">here</a>.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>But your favorite language/issue tracker is not in the list?</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Then feel free to <a href="https://github.com/preslavmihaylov/todocheck/issues/new">open an issue</a> &amp; describe your needs. Oftentimes, adding support for new languages/issue trackers is a matter of configuration, so you might see your tool in the above lists pretty soon. Here is an <a href="https://github.com/preslavmihaylov/todocheck/issues/1">example</a> of such a request.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Conclusion</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>If you want to learn more about included features &amp; configurations, consult the project's <a href="https://github.com/preslavmihaylov/todocheck/blob/master/README.md">README</a>.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Why don't you give todocheck a try right now? Download the <a href="https://github.com/preslavmihaylov/todocheck/releases/latest">latest release</a> &amp; check out the <a href="https://github.com/preslavmihaylov/todocheck#quickstart">Quickstart</a> section to get started in no-time.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Like the project? Show some love by ⭐-ing it on <a href="https://github.com/preslavmihaylov/todocheck">GitHub</a>.</p>
<!-- /wp:paragraph -->