Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Foodcritic exits 0 on failure #21

Closed
mkocher opened this Issue · 3 comments

2 participants

Matthew Kocher Andrew Crump
Matthew Kocher

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?

Andrew Crump
Owner

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.

Cheers,

Andrew.

Matthew Kocher

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?

Andrew Crump
Owner

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.

Andrew Crump acrmp closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.