Rubocop

Ruby Linter

RuboCop is a Ruby static code analyzer (a.k.a. linter) and code formatter. Out of the box it will enforce many of the guidelines outlined in the community Ruby Style Guide.

Installation

$ gem install rubocop

Configuration

Rubocop configuration is saved in a .rubocop.yml file. Check the official documentation for the file syntax or available settings.

Usage

# Analyze all the files in the current directory and its subdirectories
$ rubocop

# Analyze specific folders or files
$ rubocop directory1 directory2 path/to/somefile.rb

In order to have live linting in your text editor, the use of a rubocop integration is strongly encouraged, i.e. see https://github.com/SublimeLinter/SublimeLinter-rubocop for Sublime Text 3.

Last updated