diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9cb029a..58ca9e2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,12 +1,12 @@ repos: - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.991 + rev: v1.10.1 hooks: - id: mypy args: [--ignore-missing-imports] - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.2.1 + rev: v0.5.2 hooks: # Run the linter. - id: ruff diff --git a/README.md b/README.md index 6deb543..0fc961c 100644 --- a/README.md +++ b/README.md @@ -95,3 +95,22 @@ To enable sorting of imports using ruff's isort functionality, add `"I"` to the `python-lsp-ruff` supports code actions as given by possible fixes by `ruff`. `python-lsp-ruff` also supports [unsafe fixes](https://docs.astral.sh/ruff/linter/#fix-safety). Fixes considered unsafe by `ruff` are marked `(unsafe)` in the code action. The `Fix all` code action *only* consideres safe fixes. + +## Debugging + +The log level can be set via the `cmd` option of `pylsp`: + +```lua +lspconfig.pylsp.setup { + cmd = {"pylsp", "-vvv", "--log-file", "/tmp/lsp.log"}, + settings = { + pylsp = { + plugins = { + ruff = { + enabled = true, + }, + } + } + } +} +``` diff --git a/pylsp_ruff/plugin.py b/pylsp_ruff/plugin.py index ed6156f..833f16b 100644 --- a/pylsp_ruff/plugin.py +++ b/pylsp_ruff/plugin.py @@ -210,7 +210,7 @@ def create_diagnostic(check: RuffCheck, settings: PluginSettings) -> Diagnostic: # Ruff intends to implement severity codes in the future, # see https://github.com/charliermarsh/ruff/issues/645. severity = DiagnosticSeverity.Warning - if check.code == "E999" or check.code[0] == "F": + if check.code == "None" or check.code == "E999" or check.code[0] == "F": severity = DiagnosticSeverity.Error # Check if check.code starts contained in given severities diff --git a/pyproject.toml b/pyproject.toml index 8787263..88730ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ name = "python-lsp-ruff" authors = [ {name = "Julian Hossbach", email = "julian.hossbach@gmx.de"} ] -version = "2.2.1" +version = "2.2.2" description = "Ruff linting plugin for pylsp" readme = "README.md" requires-python = ">=3.8"