Foodcritic Inline Comment Tip

After going through the incredible Test Kitchen Getting Started Guide and finding a couple great starting cookbook templates (skeleton and meez) I got busy building a few new cookbooks: redis, serf, nodejs and hipache for octohost.

Part of the process involved running all of my cookbooks through Foodcritic, Tailor and Rubocop which found a ton of improvements and things to clean up.

One item that really frustrated me was when Foodcritic gave me an error that I couldn’t really fix - because it wasn’t really an error. Those errors actually blocked my progress because rake test wouldn’t complete successfully and start up Test Kitchen unless all “errors” were fixed.

I didn’t want to ignore the error, I just knew that it didn’t apply in this particular case.

I finally found out that:

If you add a specially formatted comment, you can ignore that particular instance of the Foodcritic error.

Take a look here at how I ignored FC005.

I couldn’t find that information in the documentation - but I saw it in an issue and found it via Github search.

That’s very handy and I will be using that in the future.

 Share!