diff --git a/CONFIGURATION.md b/CONFIGURATION.md index 2b289de9..aed5627f 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -12,6 +12,7 @@ This server can be configured using the `workspace/didChangeConfiguration` metho | `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` of `string` items | List of errors and warnings to ignore (or skip). | `[]` | +| `pylsp.plugins.flake8.maxComplexity` | `integer` | Maximum allowed complexity threshold. | `null` | | `pylsp.plugins.flake8.maxLineLength` | `integer` | Maximum allowed line length for the entirety of this run. | `null` | | `pylsp.plugins.flake8.indentSize` | `integer` | Set indentation spaces. | `null` | | `pylsp.plugins.flake8.perFileIgnores` | `array` of `string` items | A pairing of filenames and violation codes that defines which violations to ignore in a particular file, for example: `["file_path.py:W305,W304"]`). | `[]` | diff --git a/pylsp/config/flake8_conf.py b/pylsp/config/flake8_conf.py index bdc34767..56debe4e 100644 --- a/pylsp/config/flake8_conf.py +++ b/pylsp/config/flake8_conf.py @@ -27,6 +27,7 @@ ('filename', 'plugins.flake8.filename', list), ('hang-closing', 'plugins.flake8.hangClosing', bool), ('ignore', 'plugins.flake8.ignore', list), + ('max-complexity', 'plugins.flake8.maxComplexity', int), ('max-line-length', 'plugins.flake8.maxLineLength', int), ('indent-size', 'plugins.flake8.indentSize', int), ('select', 'plugins.flake8.select', list), diff --git a/pylsp/config/schema.json b/pylsp/config/schema.json index 68a7bc79..7e235001 100644 --- a/pylsp/config/schema.json +++ b/pylsp/config/schema.json @@ -60,6 +60,11 @@ }, "description": "List of errors and warnings to ignore (or skip)." }, + "pylsp.plugins.flake8.maxComplexity": { + "type": "integer", + "default": null, + "description": "Maximum allowed complexity threshold." + }, "pylsp.plugins.flake8.maxLineLength": { "type": ["integer", "null"], "default": null, diff --git a/pylsp/plugins/flake8_lint.py b/pylsp/plugins/flake8_lint.py index 0c5e09f6..b1a321d3 100644 --- a/pylsp/plugins/flake8_lint.py +++ b/pylsp/plugins/flake8_lint.py @@ -61,6 +61,7 @@ def pylsp_lint(workspace, document): 'filename': settings.get('filename'), 'hang-closing': settings.get('hangClosing'), 'ignore': ignores or None, + 'max-complexity': settings.get('maxComplexity'), 'max-line-length': settings.get('maxLineLength'), 'indent-size': settings.get('indentSize'), 'select': settings.get('select'),