From 42183d1b5e3e3c9d1074d608ca7645d80c332e2e Mon Sep 17 00:00:00 2001 From: nathdwek Date: Thu, 19 Oct 2017 17:41:26 +0200 Subject: [PATCH 1/2] Python: formater->formatter --- docs/options.md | 20 ++++++++++---------- package.json | 2 +- src/beautifiers/pybeautifier.coffee | 20 ++++++++++---------- src/languages/python.coffee | 2 +- src/options.json | 6 +++--- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/docs/options.md b/docs/options.md index 19e54ff..d58f472 100644 --- a/docs/options.md +++ b/docs/options.md @@ -10262,7 +10262,7 @@ Automatically beautify Puppet files on save | `disabled` | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `default_beautifier` | :white_check_mark: | :white_check_mark: | :white_check_mark: | | `beautify_on_save` | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| `formater` | :white_check_mark: | :white_check_mark: | :x: | +| `formatter` | :white_check_mark: | :white_check_mark: | :x: | | `ignore` | :white_check_mark: | :white_check_mark: | :x: | | `indent_size` | :white_check_mark: | :white_check_mark: | :x: | | `max_line_length` | :white_check_mark: | :white_check_mark: | :x: | @@ -10329,11 +10329,11 @@ Automatically beautify Python files on save 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*Beautify On Save*" and change it to your desired configuration. -##### [Formater](#formater) +##### [Formatter](#formatter) **Namespace**: `python` -**Key**: `formater` +**Key**: `formatter` **Default**: `autopep8` @@ -10352,7 +10352,7 @@ formatter used by pybeautifier (Supported by autopep8, pybeautifier) ```json { "python": { - "formater": "autopep8" + "formatter": "autopep8" } } ``` @@ -19982,11 +19982,11 @@ do not fix these errors/warnings (Supported by autopep8, pybeautifier) } ``` -##### [Formater](#formater) +##### [Formatter](#formatter) **Namespace**: `python` -**Key**: `formater` +**Key**: `formatter` **Default**: `autopep8` @@ -20005,7 +20005,7 @@ formatter used by pybeautifier (Supported by autopep8, pybeautifier) ```json { "python": { - "formater": "autopep8" + "formatter": "autopep8" } } ``` @@ -20335,11 +20335,11 @@ do not fix these errors/warnings (Supported by autopep8, pybeautifier) } ``` -##### [Formater](#formater) +##### [Formatter](#formatter) **Namespace**: `python` -**Key**: `formater` +**Key**: `formatter` **Default**: `autopep8` @@ -20358,7 +20358,7 @@ formatter used by pybeautifier (Supported by autopep8, pybeautifier) ```json { "python": { - "formater": "autopep8" + "formatter": "autopep8" } } ``` diff --git a/package.json b/package.json index 17b14a7..9f3edb5 100644 --- a/package.json +++ b/package.json @@ -445,4 +445,4 @@ "prettydiff2" ] } -} +} \ No newline at end of file diff --git a/src/beautifiers/pybeautifier.coffee b/src/beautifiers/pybeautifier.coffee index 696428e..f91ed29 100644 --- a/src/beautifiers/pybeautifier.coffee +++ b/src/beautifiers/pybeautifier.coffee @@ -14,7 +14,7 @@ MULTI_LINE_OUTPUT_TABLE = { 'NOQA': 6 } -format = (data, formaters) -> +format = (data, formatters) -> return new Promise (resolve, reject) -> client = new net.Socket() client.on 'error', (error) -> @@ -22,7 +22,7 @@ format = (data, formaters) -> reject(error) client.connect PORT, HOST, -> client.setEncoding('utf8') - client.write(JSON.stringify({'data': data, 'formaters': formaters})) + client.write(JSON.stringify({'data': data, 'formatters': formatters})) response = '' client.on 'data', (chunk) -> response += chunk @@ -45,22 +45,22 @@ module.exports = class PythonBeautifier extends Beautifier } beautify: (text, language, options) -> - formater = {'name': options.formater} - if options.formater == 'autopep8' - formater.config = { + formatter = {'name': options.formatter} + if options.formatter == 'autopep8' + formatter.config = { 'ignore': options.ignore 'max_line_length': options.max_line_length } - else if options.formater == 'yapf' - formater.config = {'style_config': options.style_config} - formaters = [formater] + else if options.formatter == 'yapf' + formatter.config = {'style_config': options.style_config} + formatters = [formatter] if options.sort_imports multi_line_output = MULTI_LINE_OUTPUT_TABLE[options.multi_line_output] - formaters.push + formatters.push 'name': 'isort' 'config': {'multi_line_output': multi_line_output} return new @Promise (resolve, reject) -> - format(text, formaters) + format(text, formatters) .then (data) -> resolve(data) .catch (error) -> diff --git a/src/languages/python.coffee b/src/languages/python.coffee index b8d8f4d..0ec16bb 100644 --- a/src/languages/python.coffee +++ b/src/languages/python.coffee @@ -34,7 +34,7 @@ module.exports = { items: type: 'string' description: "do not fix these errors/warnings" - formater: + formatter: type: 'string' default: 'autopep8' enum: ['autopep8', 'yapf'] diff --git a/src/options.json b/src/options.json index 8767e0d..e33d14b 100644 --- a/src/options.json +++ b/src/options.json @@ -6108,7 +6108,7 @@ "namespace": "python" } }, - "formater": { + "formatter": { "type": "string", "default": "autopep8", "enum": [ @@ -6116,12 +6116,12 @@ "yapf" ], "description": "formatter used by pybeautifier (Supported by autopep8, pybeautifier)", - "title": "Formater", + "title": "Formatter", "beautifiers": [ "autopep8", "pybeautifier" ], - "key": "formater", + "key": "formatter", "language": { "name": "Python", "namespace": "python" From 2cb86a679a44ebcace793127ac7e384ab2c767b9 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Thu, 1 Mar 2018 20:15:27 -0400 Subject: [PATCH 2/2] Add changelog entry for breaking change to pybeautifier. #1898 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ecd8ce3..a18faf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # Next +- Breaking change to `pybeautifier`: Fix typo, change `formater` to `formatter`. See [#1898](https://github.com/Glavin001/atom-beautify/pull/1898). - Fixes [#1773](https://github.com/Glavin001/atom-beautify/issues/1773) and [#793](https://github.com/Glavin001/atom-beautify/issues/793). ruby-beautify with Rubocop now respects `Exclude` settings, and properly loads inherited config files (like `~/.rubocop.yml`) - Fix [#1862](https://github.com/Glavin001/atom-beautify/issues/1862) Add support for ocp-indent as an executable - See [#601](https://github.com/Glavin001/atom-beautify/issues/1862) Add support for tsx files