Enforcing consistent coding style with RuboCop

18 views
Skip to first unread message

Erik Michaels-Ober

unread,
Aug 16, 2014, 9:57:57 AM8/16/14
to rapi...@googlegroups.com
I've enabled RuboCop to enforce a number of new coding style rules.

What does this mean for you?

This means your build will fail if you don't follow the coding conventions. This may be annoying at first but it will ensure that the project is written in a consistent style, despite having many diverse open-source contributors.

Who made up these rules?

By default, RuboCop enforces the rules prescribed in The Ruby Style Guide. These rules have been thoughtfully considered and are typically exist for good reasons. That said, RuboCop is highly configurable and makes it easy to override rules that we decide aren't right for this project.

How can I check whether I'm following the rules?

You can run the following command from within the RapidFTR Rails application:

    bundle exec rubocop --rails

RuboCop has the ability to automatically fix certain style guide violations. Just add the --auto-correct flag (or -a for short) to the above command.

Thanks to the Rapid Rails Girls (@BriocheBerlin and @kat-crumbs) for adding RuboCop to RapidFTR in the first place.

Subhas Dandapani

unread,
Aug 16, 2014, 1:19:12 PM8/16/14
to rapi...@googlegroups.com
This is awesome, and a huge improvement to code consistency!

Adding to that, you can also run all the quality checks using:

rake quality:all

Again added by the RapidRailsGirls. Great work all around!


--
You received this message because you are subscribed to the Google Groups "rapidftr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rapidftr+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
- Subhas
Reply all
Reply to author
Forward
0 new messages