Foodcritic exits 0 on failure #21

mkocher opened this Issue Apr 10, 2012 · 3 comments


None yet

2 participants

mkocher commented Apr 10, 2012

I'm really enjoying foodcritic, and am working on getting pivotal_workstation linting on travis. It looks like there's some code that attempts to exit with an exit code, but it doesn't seem complete?

acrmp commented Apr 10, 2012

Hi Matthew,

Awesome - that would be very cool.

It should set the exit code if you provide the -f / --epic-fail flag:

# Fail on any warning:
foodcritic -f any my_cookbook

# Fail for correctness problems only:
foodcritic -f correctness my_cookbook

# Fail on a specific warning only:
foodcritic -f FC005 my_cookbook

Let me know if that doesn't work for you though.



mkocher commented Apr 11, 2012

Ah, reading the docs would have helped more than reading the wrong check method. That works perfectly for me, I wrote up a blog post on using foodcritic with travis.

Any reason to not make '-f any' the default?

acrmp commented Apr 11, 2012

Nice one! Thanks for the blog post, the Travis team retweeted you pretty quickly too.

There were a couple of reasons at the time I shied away from making any the default:

  • Backwards-compatibility. People had already started trying to use foodcritic in their builds before -f was added and I didn't want to break everything on a minor change.
  • Any is possibly too harsh for most people as a default. I suggest in the docs using -f correctness as a good starting point.

I'll update the FAQ to call out the -f option so its more obvious, it's a bit buried at the moment.

@acrmp acrmp closed this Apr 11, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment