skip to Main Content
I love standardrb
Director of Engineering
February 28 2019

How do you format your ruby code across developers and projects?

I confess, I’m in love with standardrb. I’ve used other formatting tools like the hound and rubocop, but standardrb is great because it takes all the choice away from me. I’ll be honest, I didn’t even look at the ruleset; the fact that some great ruby consultancies use it is enough for me. I just install the tool using bundle, add it to a pre commit hook, and all the ruby code I check in is formatted beautifully. And if there are any other flaws in my code that standardrb can catch (like an unused variable), they are noted before my code even commits.

Here’s my precommit hook.

if git rev-parse --verify HEAD >/dev/null 2>&1
        # Initial commit: diff against an empty tree object

# Redirect output to stderr.
exec 1>&2

standardrb --fix app test config

The one issue I have is that when changes are made by standardrb, the commit fails, but I have to remember to re-add the modified files. Nothing a little –amend can’t fix, but slightly annoying.

Sometimes taking choice away gives you more freedom. Try standardrb today.

Culture Foundry is the digital difference for an amazing array of clients. If you’re looking for exceptional digital design, development and support, contact us.
(Psst! We also happen to be a great place to work.)

Back To Top
×Close search