Move shell expansion into --config lookup#10219
Merged
charliermarsh merged 2 commits intomainfrom Mar 4, 2024
Merged
Conversation
0c765a3 to
9212c42
Compare
Contributor
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| PLC0415 | 7 | 0 | 7 | 0 | 0 |
| PLR6201 | 1 | 0 | 1 | 0 | 0 |
9212c42 to
d462d66
Compare
MichaReiser
approved these changes
Mar 4, 2024
AlexWaygood
reviewed
Mar 4, 2024
Member
|
Thanks for fixing -- sorry I missed this! |
d462d66 to
de7d227
Compare
AlexWaygood
approved these changes
Mar 4, 2024
| } | ||
| // Convert to UTF-8. | ||
| let Some(value) = value.to_str() else { | ||
| // But respect non-UTF-8 paths. |
Member
There was a problem hiding this comment.
Worth adding a test with a non-UTF-8 path?
Member
Author
There was a problem hiding this comment.
I'm gonna defer it, I don't even know if Ruff as a whole will work with non-UTF-8 paths.
de7d227 to
06f3006
Compare
nkxxll
pushed a commit
to nkxxll/ruff
that referenced
this pull request
Mar 10, 2024
## Summary When users provide configurations via `--config`, we use `shellexpand` to ensure that we expand signifiers like `~` and environment variables. In astral-sh#9599, we modified `--config` to accept either a path or an arbitrary setting. However, the detection (to determine whether the value is a path or a setting) was lacking the `shellexpand` behavior -- it was downstream. So we were always treating paths like `~/ruff.toml` as values, not paths. Closes astral-sh/ruff-vscode#413.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When users provide configurations via
--config, we useshellexpandto ensure that we expand signifiers like~and environment variables.In #9599, we modified
--configto accept either a path or an arbitrary setting. However, the detection (to determine whether the value is a path or a setting) was lacking theshellexpandbehavior -- it was downstream. So we were always treating paths like~/ruff.tomlas values, not paths.Closes astral-sh/ruff-vscode#413.