2018-03-19 15:42:38 +03:00
|
|
|
# rubocop
|
|
|
|
|
|
|
|
> Lint Ruby files.
|
|
|
|
|
2018-03-19 17:34:19 +03:00
|
|
|
- Check all files in the current directory (including subdirectories):
|
2018-03-19 15:42:38 +03:00
|
|
|
|
|
|
|
`rubocop`
|
|
|
|
|
2018-03-19 17:34:19 +03:00
|
|
|
- Check one or more specific files or directories:
|
2018-03-19 15:42:38 +03:00
|
|
|
|
2018-03-19 17:49:56 +03:00
|
|
|
`rubocop {{path/to/file}} {{path/to/directory}}`
|
2018-03-19 15:42:38 +03:00
|
|
|
|
|
|
|
- Write output to file:
|
|
|
|
|
2018-03-19 17:49:56 +03:00
|
|
|
`rubocop --out {{path/to/file}}`
|
2018-03-19 15:42:38 +03:00
|
|
|
|
2018-03-19 17:34:55 +03:00
|
|
|
- View list of cops (linter rules):
|
2018-03-19 15:42:38 +03:00
|
|
|
|
|
|
|
`rubocop --show-cops`
|
|
|
|
|
|
|
|
- Exclude a cop:
|
|
|
|
|
|
|
|
`rubocop --except {{cop_1}} {{cop_2}}`
|
|
|
|
|
|
|
|
- Run only specified cops:
|
|
|
|
|
|
|
|
`rubocop --only {{cop_1}} {{cop_2}}`
|
|
|
|
|
|
|
|
- Auto-correct files (experimental):
|
|
|
|
|
|
|
|
`rubocop --auto-correct`
|