From 41b7bc6f0b3da26f8e1d8062f41d3eeceb680377 Mon Sep 17 00:00:00 2001 From: Gerardo Gomez Date: Tue, 13 Jul 2021 23:10:55 +0300 Subject: [PATCH 1/2] docs: document internal flake8 plugin schema and configuration --- CONFIGURATION.md | 10 ++++++++ pylsp/config/schema.json | 50 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/CONFIGURATION.md b/CONFIGURATION.md index 96559c75..7a1cad58 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -4,6 +4,16 @@ This server can be configured using `workspace/didChangeConfiguration` method. E | **Configuration Key** | **Type** | **Description** | **Default** |----|----|----|----| | `pylsp.configurationSources` | `array` of unique `string` items | List of configuration sources to use. | `["pycodestyle"]` | +| `pylsp.plugins.flake8.config` | `string` | Path to the config file that will be the authoritative config source. | `null` | +| `pylsp.plugins.flake8.enabled` | `boolean` | Enable or disable the plugin. | `false` | +| `pylsp.plugins.flake8.exclude` | `array` | List of files or directories to exclude. | `null` | +| `pylsp.plugins.flake8.executable` | `string` | Path to the flake8 executable. | `"flake8"` | +| `pylsp.plugins.flake8.filename` | `string` | Only check for filenames matching the patterns in this list. | `null` | +| `pylsp.plugins.flake8.hangClosing` | `boolean` | Hang closing bracket instead of matching indentation of opening bracket's line. | `null` | +| `pylsp.plugins.flake8.ignore` | `array` | List of errors and warnings to ignore (or skip). | `null` | +| `pylsp.plugins.flake8.maxLineLength` | `integer` | Maximum allowed line length for the entirety of this run. | `null` | +| `pylsp.plugins.flake8.perFileIgnores` | `array` | A pairing of filenames and violation codes that defines which violations to ignore in a particular file. | `null` | +| `pylsp.plugins.flake8.select` | `array` | List of errors and warnings to enable. | `null` | | `pylsp.plugins.jedi.extra_paths` | `array` | Define extra paths for jedi.Script. | `[]` | | `pylsp.plugins.jedi.env_vars` | `object` | Define environment variables for jedi.Script and Jedi.names. | `null` | | `pylsp.plugins.jedi.environment` | `string` | Define environment for jedi.Script and Jedi.names. | `null` | diff --git a/pylsp/config/schema.json b/pylsp/config/schema.json index b0467653..22bc7bbd 100644 --- a/pylsp/config/schema.json +++ b/pylsp/config/schema.json @@ -14,6 +14,56 @@ }, "uniqueItems": true }, + "pylsp.plugins.flake8.config": { + "type": "string", + "default": null, + "description": "Path to the config file that will be the authoritative config source." + }, + "pylsp.plugins.flake8.enabled": { + "type": "boolean", + "default": false, + "description": "Enable or disable the plugin." + }, + "pylsp.plugins.flake8.exclude": { + "type": "array", + "default": null, + "description": "List of files or directories to exclude." + }, + "pylsp.plugins.flake8.executable": { + "type": "string", + "default": "flake8", + "description": "Path to the flake8 executable." + }, + "pylsp.plugins.flake8.filename": { + "type": "string", + "default": null, + "description": "Only check for filenames matching the patterns in this list." + }, + "pylsp.plugins.flake8.hangClosing": { + "type": "boolean", + "default": null, + "description": "Hang closing bracket instead of matching indentation of opening bracket's line." + }, + "pylsp.plugins.flake8.ignore": { + "type": "array", + "default": null, + "description": "List of errors and warnings to ignore (or skip)." + }, + "pylsp.plugins.flake8.maxLineLength": { + "type": "integer", + "default": null, + "description": "Maximum allowed line length for the entirety of this run." + }, + "pylsp.plugins.flake8.perFileIgnores": { + "type": "array", + "default": null, + "description": "A pairing of filenames and violation codes that defines which violations to ignore in a particular file." + }, + "pylsp.plugins.flake8.select": { + "type": "array", + "default": null, + "description": "List of errors and warnings to enable." + }, "pylsp.plugins.jedi.extra_paths": { "type": "array", "default": [], From cb6faab55602e8736e0699eee59b23e156afcc4e Mon Sep 17 00:00:00 2001 From: krassowski Date: Sat, 24 Jul 2021 11:45:58 +0100 Subject: [PATCH 2/2] Add an example for `flake8.perFileIgnores` --- CONFIGURATION.md | 2 +- pylsp/config/schema.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CONFIGURATION.md b/CONFIGURATION.md index 7a1cad58..e84c09d0 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -12,7 +12,7 @@ This server can be configured using `workspace/didChangeConfiguration` method. E | `pylsp.plugins.flake8.hangClosing` | `boolean` | Hang closing bracket instead of matching indentation of opening bracket's line. | `null` | | `pylsp.plugins.flake8.ignore` | `array` | List of errors and warnings to ignore (or skip). | `null` | | `pylsp.plugins.flake8.maxLineLength` | `integer` | Maximum allowed line length for the entirety of this run. | `null` | -| `pylsp.plugins.flake8.perFileIgnores` | `array` | A pairing of filenames and violation codes that defines which violations to ignore in a particular file. | `null` | +| `pylsp.plugins.flake8.perFileIgnores` | `array` | A pairing of filenames and violation codes that defines which violations to ignore in a particular file, for example: `["file_path.py:W305,W304"]`). | `null` | | `pylsp.plugins.flake8.select` | `array` | List of errors and warnings to enable. | `null` | | `pylsp.plugins.jedi.extra_paths` | `array` | Define extra paths for jedi.Script. | `[]` | | `pylsp.plugins.jedi.env_vars` | `object` | Define environment variables for jedi.Script and Jedi.names. | `null` | diff --git a/pylsp/config/schema.json b/pylsp/config/schema.json index 22bc7bbd..bd4c2e70 100644 --- a/pylsp/config/schema.json +++ b/pylsp/config/schema.json @@ -57,7 +57,7 @@ "pylsp.plugins.flake8.perFileIgnores": { "type": "array", "default": null, - "description": "A pairing of filenames and violation codes that defines which violations to ignore in a particular file." + "description": "A pairing of filenames and violation codes that defines which violations to ignore in a particular file, for example: `[\"file_path.py:W305,W304\"]`)." }, "pylsp.plugins.flake8.select": { "type": "array",