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.
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
Documentation: 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: product.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.
24 files inspected, no offenses detected