tldr/pages/osx/rubocop.md

32 lines
522 B
Markdown
Raw Normal View History

2018-03-19 12:42:38 +00:00
# rubocop
> Lint Ruby files.
2018-03-19 14:34:19 +00:00
- Check all files in the current directory (including subdirectories):
2018-03-19 12:42:38 +00:00
`rubocop`
2018-03-19 14:34:19 +00:00
- Check one or more specific files or directories:
2018-03-19 12:42:38 +00:00
2018-03-19 14:49:56 +00:00
`rubocop {{path/to/file}} {{path/to/directory}}`
2018-03-19 12:42:38 +00:00
- Write output to file:
2018-03-19 14:49:56 +00:00
`rubocop --out {{path/to/file}}`
2018-03-19 12:42:38 +00:00
2018-03-19 14:34:55 +00:00
- View list of cops (linter rules):
2018-03-19 12:42:38 +00: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`