diff --git a/bundled/tool/find_ruff_binary_path.py b/bundled/tool/find_ruff_binary_path.py index aaca26d..b22f5c9 100644 --- a/bundled/tool/find_ruff_binary_path.py +++ b/bundled/tool/find_ruff_binary_path.py @@ -30,6 +30,13 @@ def find_ruff_binary_path() -> Optional[Path]: if __name__ == "__main__": + # Python defaults to the system's local encoding for stdout on Windows. + # source: https://docs.python.org/3/library/sys.html#sys.stdout + # + # But not all paths are representable by the local encoding. + # The node process calling this script defaults to UTF8, so let's do the same here. + sys.stdout.reconfigure(encoding="utf-8") # type: ignore [attr-defined] # We never reconfigure stdout, thus it is guaranteed to not be Any + ruff_binary_path = find_ruff_binary_path() if ruff_binary_path: - print(os.fsdecode(str(ruff_binary_path)), flush=True) + print(ruff_binary_path, flush=True) diff --git a/package.json b/package.json index 5d20671..9900bf0 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "scripts": { "fmt": "prettier -w .", "fmt-check": "prettier --check .", - "lint": "eslint src --ext ts", + "lint": "eslint src --ext ts --max-warnings=0", "compile": "webpack", "compile-tests": "tsc -p . --outDir out", "tsc": "tsc --noEmit", diff --git a/pyproject.toml b/pyproject.toml index 06d6314..42e355d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ dev = ["mypy==1.2.0", "python-lsp-jsonrpc==1.0.0"] [tool.ruff] line-length = 88 target-version = "py37" -extend-exclude = ["bundled/libs", "scr/testFixture"] +extend-exclude = ["bundled/libs", "src/testFixture"] [tool.ruff.lint] select = ["E", "F", "W", "Q", "UP", "I", "N"] diff --git a/src/common/constants.ts b/src/common/constants.ts index c12738a..cf30b56 100644 --- a/src/common/constants.ts +++ b/src/common/constants.ts @@ -11,7 +11,7 @@ export const EXTENSION_ROOT_DIR = /** * Name of the `ruff` binary based on the current platform. */ -export const RUFF_BINARY_NAME = process.platform == "win32" ? "ruff.exe" : "ruff"; +export const RUFF_BINARY_NAME = process.platform === "win32" ? "ruff.exe" : "ruff"; /** * Path to the directory containing the bundled Python scripts.