# Tracking TODO and FIXME Comments with Rails Notes Command

*Published on January 03, 2023*

---


When you're programming, you often run into code that needs to be changed, whether for refactoring, minor fixes, or performance optimizations. A common solution is to add a FIXME or TODO comment to come back to the code later.

However, we often forget to review those comments, which linger in the codebase. Sometimes we update/fix the code and forget to remove the notes, and now you have misleading comments. You can do a global search for the specific tags to keep track of them, but there's a better way to accomplish this using the&nbsp;`rails notes`&nbsp;command, which neatly lists these comments in the console.

The&nbsp;`bin/rails notes`&nbsp;command searches through your code for comments beginning with a specific keyword. By default, this command will search in your&nbsp;`app`,&nbsp;`config`,&nbsp;`db`,&nbsp;`lib`, and&nbsp;`test`&nbsp;directories for&nbsp;`FIXME`,&nbsp;`OPTIMIZE`, and&nbsp;`TODO`&nbsp;comments.

```ruby
# FIXME: extract to a method
def publish

end

-> bin/rails notes

app/models/post.rb:
  * [10] [FIXME] extract to a method
  * [20] [TODO] refactor this method
```

You can also use custom keywords in the comments and specify the new keyword to the&nbsp;`notes`&nbsp;command using the&nbsp;`-a`&nbsp;flag.

```ruby
# REMINDER: update gem version 
def publish

end
 
➜ bin/rails notes -a REMINDER

app/helpers/post_helper.rb:
  * [10] update gem version
```

## Configure Custom Tags

Using custom keywords can get tedious if you have to mention them every time in the command. To solve this, Rails allows you to configure custom tags in a single place, by using&nbsp;`config.annotations.register_tags`&nbsp;method.

```ruby
# config/environments/development.rb

Rails.application.configure do
  config.annotations.register_tags("TESTME")
end
```

The&nbsp;`notes`&nbsp;command will now look for the&nbsp;`TESTME`&nbsp;tag in your codebase.

```bash
$ bin/rails notes

app/models/post.rb:
  * [ 42] [TESTME] add unit test
```

What do you think? Do you use any custom comments in your code, other than&nbsp;`FIXME`s or&nbsp;`TODO`s? Let me know in the comments below.

