From 00257f750796b010af99fc6399044c1435a6735c Mon Sep 17 00:00:00 2001 From: Rafal Chlodnicki Date: Tue, 31 Mar 2026 23:49:41 +0200 Subject: [PATCH 1/2] refactor: add ruff rules for sorting imports --- plugin/client.py | 20 ++++++++++---------- plugin/log.py | 4 +--- plugin/template.py | 4 +--- pyproject.toml | 11 ++++++++++- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/plugin/client.py b/plugin/client.py index 638b30d..cf32359 100644 --- a/plugin/client.py +++ b/plugin/client.py @@ -1,18 +1,18 @@ from __future__ import annotations -import json -import os -from typing import Any, final - -import jmespath -import sublime -from LSP.plugin import ClientConfig, DottedDict -from lsp_utils import NpmClientHandler -from typing_extensions import override - from .constants import PACKAGE_NAME from .log import log_warning from .template import load_string_template +from LSP.plugin import ClientConfig +from LSP.plugin import DottedDict +from lsp_utils import NpmClientHandler +from typing import Any +from typing import final +from typing_extensions import override +import jmespath +import json +import os +import sublime @final diff --git a/plugin/log.py b/plugin/log.py index a463713..ec5d4f6 100644 --- a/plugin/log.py +++ b/plugin/log.py @@ -1,11 +1,9 @@ from __future__ import annotations +from .constants import PACKAGE_NAME from typing import Any - import sublime -from .constants import PACKAGE_NAME - def log_debug(message: str) -> None: print(f"[{PACKAGE_NAME}][DEBUG] {message}") diff --git a/plugin/template.py b/plugin/template.py index aed0f8a..7623d23 100644 --- a/plugin/template.py +++ b/plugin/template.py @@ -1,12 +1,10 @@ from __future__ import annotations +from .constants import PACKAGE_NAME from functools import lru_cache - import jinja2 import sublime -from .constants import PACKAGE_NAME - JINJA_TEMPLATE_ENV = jinja2.Environment( extensions=[ "jinja2.ext.do", diff --git a/pyproject.toml b/pyproject.toml index 84f5ea2..2fa2497 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,8 +62,17 @@ exclude = [ ] [tool.ruff.lint] -select = ["E", "F", "W", "I", "UP", "FURB", "SIM"] +select = ["E", "F", "W", "I", "UP", "FURB", "SIM", "F401"] ignore = ["E203"] +preview = true [tool.ruff.lint.per-file-ignores] "boot.py" = ["E402"] + +[tool.ruff.lint.isort] +case-sensitive = false +force-single-line = true +from-first = true +no-sections = true +order-by-type = false +required-imports = ["from __future__ import annotations"] From b3be5707788c8d318dfe8a808b81bd2de87cf846 Mon Sep 17 00:00:00 2001 From: Rafal Chlodnicki Date: Sun, 5 Apr 2026 22:12:41 +0200 Subject: [PATCH 2/2] update rules --- plugin/client.py | 20 ++++++++++---------- plugin/log.py | 4 +++- plugin/template.py | 4 +++- pyproject.toml | 9 +++------ 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/plugin/client.py b/plugin/client.py index cf32359..638b30d 100644 --- a/plugin/client.py +++ b/plugin/client.py @@ -1,18 +1,18 @@ from __future__ import annotations -from .constants import PACKAGE_NAME -from .log import log_warning -from .template import load_string_template -from LSP.plugin import ClientConfig -from LSP.plugin import DottedDict -from lsp_utils import NpmClientHandler -from typing import Any -from typing import final -from typing_extensions import override -import jmespath import json import os +from typing import Any, final + +import jmespath import sublime +from LSP.plugin import ClientConfig, DottedDict +from lsp_utils import NpmClientHandler +from typing_extensions import override + +from .constants import PACKAGE_NAME +from .log import log_warning +from .template import load_string_template @final diff --git a/plugin/log.py b/plugin/log.py index ec5d4f6..a463713 100644 --- a/plugin/log.py +++ b/plugin/log.py @@ -1,9 +1,11 @@ from __future__ import annotations -from .constants import PACKAGE_NAME from typing import Any + import sublime +from .constants import PACKAGE_NAME + def log_debug(message: str) -> None: print(f"[{PACKAGE_NAME}][DEBUG] {message}") diff --git a/plugin/template.py b/plugin/template.py index 7623d23..aed0f8a 100644 --- a/plugin/template.py +++ b/plugin/template.py @@ -1,10 +1,12 @@ from __future__ import annotations -from .constants import PACKAGE_NAME from functools import lru_cache + import jinja2 import sublime +from .constants import PACKAGE_NAME + JINJA_TEMPLATE_ENV = jinja2.Environment( extensions=[ "jinja2.ext.do", diff --git a/pyproject.toml b/pyproject.toml index 2fa2497..a10c0ea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,17 +62,14 @@ exclude = [ ] [tool.ruff.lint] -select = ["E", "F", "W", "I", "UP", "FURB", "SIM", "F401"] +select = ["E", "F", "W", "I", "UP", "FURB", "SIM"] ignore = ["E203"] -preview = true [tool.ruff.lint.per-file-ignores] "boot.py" = ["E402"] [tool.ruff.lint.isort] -case-sensitive = false -force-single-line = true -from-first = true -no-sections = true +case-sensitive = true +combine-as-imports = true order-by-type = false required-imports = ["from __future__ import annotations"]