2018-03-19 12:42:38 +00:00
|
|
|
# rubocop
|
|
|
|
|
|
|
|
> Lint Ruby files.
|
2022-02-14 11:21:43 +00:00
|
|
|
> More information: <https://docs.rubocop.org/rubocop/usage/basic_usage.html>.
|
2018-03-19 12:42:38 +00:00
|
|
|
|
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
|
|
|
|
2024-09-08 16:51:32 +01:00
|
|
|
`rubocop {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
|
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:
|
|
|
|
|
2024-09-08 16:51:32 +01:00
|
|
|
`rubocop --except {{cop1 cop2 ...}}`
|
2018-03-19 12:42:38 +00:00
|
|
|
|
|
|
|
- Run only specified cops:
|
|
|
|
|
2024-09-08 16:51:32 +01:00
|
|
|
`rubocop --only {{cop1 cop2 ...}}`
|
2018-03-19 12:42:38 +00:00
|
|
|
|
|
|
|
- Auto-correct files (experimental):
|
|
|
|
|
|
|
|
`rubocop --auto-correct`
|