Skip to content

Redefine rake routes to add your own custom tag in Rails

by Deepak
WTFs per minute

The only valid measurement of code quality is: WTFs/minute

Now Rails has this nifty rake task called rake notes. You can always see notes for a custom tag by:

Ruby

~> rake notes:custom ANNOTATION=WTF

But rake notes by default only shows notes for OPTIMIZE, FIXME and TODO The Rakefile for changing those defaults is

Ruby

# for re-defining the Rake task
# otherwise the previous Rake task is still called
task(:notes).clear

desc "Enumerate all annotations
      (use notes:optimize, :fixme, :todo, :wtf for focus)"
task :notes do
  SourceAnnotationExtractor.enumerate "OPTIMIZE|FIXME|TODO|WTF",
                                      :tag => true
end

namespace :notes do
  task(:wtf).clear
  task :wtf do
    SourceAnnotationExtractor.enumerate "WTF", :tag => true
  end
end

Here we have redefined rake notes. The only gotcha is to remember to clear the old rake task by calling task(:notes).clear

For other customizations eg. search the spec folder also you will have to monkey-patch the SourceAnnotationExtractor class

PS: also check this Stackoverflow thread for some fun picks

More articles

  • Building our own infra using our office hardware

    How we turned a Mac mini and a stack of MacBooks into a self-hosted k3s cluster, moved our apps off a managed platform, and run it all over Tailscale.

    Read more →
  • What Is an AI Harness?

    A harness is the code that sits around an LLM and lets it actually do things: read files, run commands, search the web. The model writes text. The harness turns that text into actions, and the results back into text.

    Read more →

Your competitors are already using AI. The question is how fast you want to unlock the value.

  • Don't know where to start?

    AI is everywhere but it's unclear which investments will actually move your metrics and which are expensive experiments.

  • Your data isn't ready

    Most AI projects fail at the data layer. Pipelines, quality, access all need work before LLMs can deliver value.

  • Internal teams are stretched

    Your engineers are shipping product. They don't have capacity to also become AI specialists with production-grade experience.

  • Legacy systems block everything

    Aging, undocumented codebases make AI integration slow, risky, and expensive. They need to move first.

Don't worry. We've got you covered.

Start with the audit.

Book a free discovery call