Fixing inital Rubocop errors on Rails app

Posted by Jason Noble on 03/25/2014 in Uncategorized |

tl;dr: Solution

I’m an Ruby on Rails instructor for the DaVinci Coders program in Louisville, CO. I teach a class called Building the Toolbelt of a Junior Ruby on Rails Developer, where we teach students how to use Ruby on Rails, as well as the other tools software engineers use in their daily work.

Recently, we started working on the group projects. The group projects are the capstone project where each student pairs with one or more other students in implementing a fully developed Ruby on Rails application. This provides students the experience of coding a project from scratch, including Inception, adding/writing Tracker stories, and collaborating with others.

The first project is Geoviz. This project is going to allow users to upload datasets to the site, and allow for the creation of graphs, maps and data display.

One of the gems that they added to the project was Rubocop, which they tied into their Guard via Guard-Rubocop.

I was amazed to see A LOT of “offenses”, i.e. “39 offenses detected”. This is an app that has nothing more than the output of “rails new _____”, so that was rather surprising. Here’s how we fixed it:


We first started with running `rubocop –auto-correct`. This corrected 14 offenses by changing double quoted strings to single quoted strings. You could disable this test as well, but I think it’s “good” to use single quotes.

The next one we needed to solve:

app/controllers/application_controller.rb:1:1: C: Missing top-level class documentation comment.
class ApplicationController < ActionController::Base

We decided this wasn’t really that helpful of a test, so we disabled it by creating a .rubocop.yml file

Enabled: false

This got rid of another 4 offenses.

The rest of the offenses were lines being too long:

config/routes.rb:15:80: C: Line is too long. [80/79]
# Example of named route that can be invoked with purchase_url(id:

I guess the Rails core team likes LOOOOOOONG lines. I simply edited the files and split the long lines into two < 80 character lines. [code] 24 files inspected, no offenses detected [/code] Yay!

Copyright © 2008-2022 Jason Noble's Technical Adventures All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.5, from