Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rubocop 1.9.1 changed the cli argument to auto-correct from -a to -A #34

Open
ghost opened this issue Feb 13, 2021 · 3 comments
Open

Rubocop 1.9.1 changed the cli argument to auto-correct from -a to -A #34

ghost opened this issue Feb 13, 2021 · 3 comments

Comments

@ghost
Copy link

ghost commented Feb 13, 2021

Hi !
Thanks for the package ! Very useful !

Quick description

I just upgraded to latest rubocop gem version and wanted to use as usual the command rubocop-autoccorect-project.

The command that is runned is : bundle exec rubocop -a --format emacs /path/to/repo/

Unfortunately, they apparently decided to change the -aargument in favor to -A.

Therefore autcorrect no longer autocorrect on this rubocop version.

Versions

➜ Repo git:(master) ✗ emacs --version
GNU Emacs 27.1.50
Copyright (C) 2020 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
➜ Repo git:(master) ✗ rubocop --version
1.9.1

The man page of rubocop about autocorrect :

    -A, --auto-correct-all           Auto-correct offenses (safe and unsafe)
        --disable-pending-cops       Run without pending cops.
        --enable-pending-cops        Run with pending cops.
        --ignore-disable-comments    Run cops even when they are disabled locally
                                     with a comment.
@bbatsov
Copy link
Collaborator

bbatsov commented Feb 13, 2021

Well, that's not quite true, as -a is still around, but it's just limitted to safe auto-corrections:

 -a, --auto-correct               Auto-correct offenses (only when it's safe).
        --safe-auto-correct          (same, deprecated)
    -A, --auto-correct-all           Auto-correct offenses (safe and unsafe)

Probably we should add two commands to the Emacs extensions for the two types of corrections.

@bbatsov
Copy link
Collaborator

bbatsov commented Feb 13, 2021

Actually there's a defcustom you can just update in your Emacs config - rubocop-autocorrect-command.

@fmichaut-diff
Copy link

fmichaut-diff commented Dec 13, 2023

I think having both commands is a better alternative :
You might want to run the safe auto correct most of the time, and in some rare case run it in unsafe mode for a specific file/project ponctually.

In this case, the approach with the defcustom requires the user to change the default command, run the command, and update it back for future use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants