ruff/crates/ruff_cli
Charlie Marsh 1d2d015bc5
Make standard input detection robust to invalid arguments (#5393)
## Summary

This PR fixes a silent failure that manifested itself in
https://github.com/astral-sh/ruff-vscode/issues/238. In short, if the
user provided invalid arguments to Ruff in the VS Code extension (like
`"ruff.args": ["a"]`), then we generated something like the following
command:

```console
/path/to/ruff --force-exclude --no-cache --no-fix --format json - --fix a --stdin-filename /path/to/file.py
```

Since this contains both `-` and `a` as the "input files", Ruff would
treat this as if we're linting the files names `-` and `a`, rather than
linting standard input.

This PR modifies out standard input detection to force standard input
when `--stdin-filename` is present, or at least one file is `-`. (We
then warn and ignore the others.)
2023-06-28 14:52:23 +00:00
..
resources/test/fixtures Keep track of when files are last seen in the cache (#5214) 2023-06-23 15:40:35 +02:00
src Make standard input detection robust to invalid arguments (#5393) 2023-06-28 14:52:23 +00:00
tests Add rule documentation URL to JSON output (#5187) 2023-06-19 21:09:15 +00:00
Cargo.toml Experimental release for Jupyter notebook integration (#5363) 2023-06-26 21:22:42 +05:30