Knowledge Base: Lint, or a linter, is a static code analysis tool used to flag programming errors, bugs, stylistic errors and suspicious constructs.
Make sure you have your ruby environment(check compatibility) working before proceeding.
Installation
Simply run
% gem install rubocop
Configuration
Create a .rubocop.yml
file in your home(% cd ~
) directory for all ruby projects. Alternatively, you can create it in your project directory.
Default Configuration
Recommended Configuration
Jayesh's rubocop configuration
Usage
Check
In your project's directory,
% rubocop
or you can specify a file or a directory of your choosing.
% rubocop lib/file.rb spec/
If you don't have rubocop on your terminal, try
bundle exec rubocop
Correct
% rubocop -a
Knowledge Base: Only safe offenses will be fixed with
-a
Official Links
All rules
Here is the list of rules with their categories:
https://docs.rubocop.org/rubocop/cops.html
More Guides
RuboCop: How to install and configure
Installing and Running Rubocop
License: AGPL-3.0-or-later
Top comments (0)