diff --git a/src/beautifiers/beautifier.coffee b/src/beautifiers/beautifier.coffee index 29f82ab2f..207a0d47d 100644 --- a/src/beautifiers/beautifier.coffee +++ b/src/beautifiers/beautifier.coffee @@ -96,6 +96,10 @@ module.exports = class Beautifier deprecate: (warning) -> atom.notifications?.addWarning(warning) + deprecateOptionForExecutable: (exeName, oldOption, newOption) -> + deprecationMessage = "The \"#{oldOption}\" configuration option has been deprecated. Please switch to using the option in section \"Executables\" (near the top) in subsection \"#{exeName}\" labelled \"#{newOption}\" in Atom-Beautify package settings." + @deprecate(deprecationMessage) + ### Create temporary file ### diff --git a/src/beautifiers/fortran-beautifier/index.coffee b/src/beautifiers/fortran-beautifier/index.coffee index 00b7de59b..f437da8ff 100644 --- a/src/beautifiers/fortran-beautifier/index.coffee +++ b/src/beautifiers/fortran-beautifier/index.coffee @@ -47,7 +47,7 @@ module.exports = class FortranBeautifier extends Beautifier ] if emacs_path - @deprecate("The \"emacs_path\" has been deprecated. Please switch to using the config with path \"Executables - Emacs - Path\" in Atom-Beautify package settings now.") + @deprecateOptionForExecutable("Emacs", "emacs_path", "Path") @run(emacs_path, args, {ignoreReturnCode: false}) .then(=> @readFile(tempFile) diff --git a/src/beautifiers/php-cs-fixer.coffee b/src/beautifiers/php-cs-fixer.coffee index c9b728d4c..cc4330f35 100644 --- a/src/beautifiers/php-cs-fixer.coffee +++ b/src/beautifiers/php-cs-fixer.coffee @@ -90,8 +90,7 @@ module.exports = class PHPCSFixer extends Beautifier # Find php-cs-fixer.phar script if options.cs_fixer_path - deprecationMessage = "The \"PHP - PHP-CS-Fixer Path (cs_fixer_path)\" configuration option has been deprecated. Please switch to using the option named \"Executables - PHP-CS-Fixer - Path\" in Atom-Beautify package settings now." - @deprecate(deprecationMessage) + @deprecateOptionForExecutable("PHP - PHP-CS-Fixer Path (cs_fixer_path)", "PHP-CS-Fixer", "Path") @Promise.all([ @which(options.cs_fixer_path) if options.cs_fixer_path diff --git a/src/beautifiers/phpcbf.coffee b/src/beautifiers/phpcbf.coffee index 21a721fe2..c66635238 100644 --- a/src/beautifiers/phpcbf.coffee +++ b/src/beautifiers/phpcbf.coffee @@ -50,8 +50,7 @@ module.exports = class PHPCBF extends Beautifier phpcbf = @exe('phpcbf') if options.phpcbf_path - deprecationMessage = "The \"PHP - PHPCBF Path (phpcbf_path)\" configuration option has been deprecated. Please switch to using the option named \"Executables - PHPCBF - Path\" in Atom-Beautify package settings now." - @deprecate(deprecationMessage) + @deprecateOptionForExecutable("PHP - PHPCBF Path (phpcbf_path)", "PHPCBF", "Path") # Find phpcbf.phar script @Promise.all([