From 9b0023158cf2517fc07938f678fac8b67f1c6da3 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Mon, 24 Oct 2022 22:39:28 +0100 Subject: [PATCH] fix: use -a and -A flags to avoid deprecation warnings The --auto-correct and --auto-correct-all flags have been deprecated in favor of --autocorrect and --autocorrect-all. For the sake of backwards compatibility, we now use -a and -A which remain unchanged since auto-correction support was first added to Rubocop. Fixes #8 --- rubocopfmt.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/rubocopfmt.el b/rubocopfmt.el index b43deb0..c7bb33e 100644 --- a/rubocopfmt.el +++ b/rubocopfmt.el @@ -41,7 +41,7 @@ ;;; Commentary: ;; -;; This library formats Ruby code by using rubocop and it's --auto-correct +;; This library formats Ruby code by using rubocop and it's --autocorrect ;; option. ;;; Code: @@ -91,7 +91,7 @@ inside a `before-save-hook'." (defcustom rubocopfmt-include-unsafe-cops nil "When t include unsafe cops when auto-correcting. -Determines if --auto-correct or --auto-correct-all will be passed to rubocop." +Determines if --autocorrect or --autocorrect-all will be passed to rubocop." :type 'boolean :group 'rubocopfmt) @@ -251,8 +251,7 @@ If FILE is not found in DIRECTORY, the parent of DIRECTORY will be searched." (src-dir (file-name-directory buffer-file)) (src-file (file-name-nondirectory buffer-file)) (fmt-command rubocopfmt-rubocop-command) - (auto-correct-flag (if rubocopfmt-include-unsafe-cops - "--auto-correct-all" "--auto-correct")) + (auto-correct-flag (if rubocopfmt-include-unsafe-cops "-A" "-a")) (fmt-args (list "--stdin" src-file auto-correct-flag "--format" "emacs")))