feat(cops): Add support for running unsafe cops with latest RuboCop

Latest version of RuboCop now only performs auto-corrections from "safe"
cops when given the `--auto-correct`/`-a` option. To run
auto-corrections from all cops, including "unsafe" ones, you must now
pass in `--auto-correct-all`/`-A` instead.

The new `rubocopfmt-include-unsafe-cops` defcustom defaults to no `nil`,
for backwards compatibility. Turn on unsafe cops by setting it to `t`.
This commit is contained in:
2020-07-13 12:38:22 +01:00
parent 054681f682
commit b4be08469c
2 changed files with 23 additions and 2 deletions

View File

@@ -45,6 +45,19 @@ Place `rubocopfmt.el` somewhere into you `load-path` and require it. For example
With `rubocopfmt-mode` enabled, Ruby buffer will automatically be formatted with
RuboCop on save.
### Unsafe Cops
RuboCop no longer runs auto-corrections for unsafe cops. To enable unsafe cops,
set `rubocopfmt-include-unsafe-cops` to `t`. If you're using use-package:
```elisp
(use-package rubocopfmt
:hook
(ruby-mode . rubocopfmt-mode)
:custom
(rubocopfmt-include-unsafe-cops t))
```
## Commands
- `rubocopfmt` - Format current buffer with RuboCop.