1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/rubocop.md

33 lines
601 B
Markdown
Raw Normal View History

2018-03-19 14:42:38 +02:00
# rubocop
> Lint Ruby files.
2022-02-14 03:21:43 -08:00
> More information: <https://docs.rubocop.org/rubocop/usage/basic_usage.html>.
2018-03-19 14:42:38 +02:00
2018-03-19 16:34:19 +02:00
- Check all files in the current directory (including subdirectories):
2018-03-19 14:42:38 +02:00
`rubocop`
2018-03-19 16:34:19 +02:00
- Check one or more specific files or directories:
2018-03-19 14:42:38 +02:00
2018-03-19 16:49:56 +02:00
`rubocop {{path/to/file}} {{path/to/directory}}`
2018-03-19 14:42:38 +02:00
- Write output to file:
2018-03-19 16:49:56 +02:00
`rubocop --out {{path/to/file}}`
2018-03-19 14:42:38 +02:00
2018-03-19 16:34:55 +02:00
- View list of cops (linter rules):
2018-03-19 14:42:38 +02: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`