Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ruff discovery for paths containing symbols that can't be represented by the local encoding #584

Merged
merged 6 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion bundled/tool/find_ruff_binary_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 We never reconfigure stdout, thus it is guaranteed to not be Any
MichaReiser marked this conversation as resolved.
Show resolved Hide resolved

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)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
Loading