Random public utilities. Mainly public support files and explanatory code gists.
Install Rubocop globally to your machine:
gem install rubocop
To use the rubocop suggested common rules, add a .rubocop.yml
file at the root of your project with the following content
inherit_from:
- https://raw.githubusercontent.com/qmee/dev-public-utils/main/styleguides/rubocop.yml
If you wish to override specific rules, just add them under this inherit block according to rubocop documentation.
To use the different set of rules for spec files, add an additional .rubocop.yml
file to your spec/
folder with the following content
inherit_from:
- ../.rubocop.yml
- https://raw.githubusercontent.com/qmee/dev-public-utils/main/styleguides/rubocop-specs.yml
As with regular cops, any overrides can be added after this block.
IMPORTANT! You are heavily encouraged to add the following to your .gitignore
file to avoid committing noisy rubocop cached files
.rubocop-https*
- Install the ruby-rubocop VSCode extension
- Go to File -> Preferences -> Settings
- Search for
Rubocop
. You should see theRubocop: Execute Path
setting - Find your gem installation folder by running
gem environment gemdir
in your terminal - Navigate to this path and find the
/exe
folder for the rubocop gem (e.g. from the installation folder I navigated to/gems/rubocop-1.29.1/exe
) - Paste the full path to the
/exe
folder into theRubocop: Execute Path
setting - If your
Rubocop: On Save
setting is enabled, the Rubocop linter will run on save. Alternatively runrubocop
in your terminal to lint all files in the repository.