Configuration format depends on hardcoded `pyproject.toml` filename
- Dominant language
- Rust
- Stars
- 49.6k
- Forks
- 2.4k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 435
Description
I am currently trying to write a Nix flake check to lint our Python project. In Nix, the actual mapped name of a file from the source directory can be different from the original file name. In our case, we have to validate a workspace with multiple Python packages so the source directory and the `pyproject.toml` files are separate. I tried to get only `pyproject.toml` as a single file, which turns its filename into `/nix/store/zgx...i2-pyproject.toml`. So the command to run becomes `.../bin/ruff format --config /nix/store/zgx...i2-pyproject.toml --check --diff /nix/store/abc...def-source/`.
However, the hardcoded check below makes Ruff fail, because it requires the filename to be exactly `pyproject.toml` (`Path::ends_with` compares against the whole path component):
https://github.com/astral-sh/ruff/blob/f7fc8fb084e30c6846709cc4aa8cbd18fcc86a8b/crates/ruff_workspace/src/pyproject.rs#L161
Could you please either:
- Check whether the filename _ends_ with `pyproject.toml` (not the whole path component, but as a string match)
- Provide a command-line switch to explicitly declare which format is being used (`pyproject` or `ruff` format)
Thank you!
Contributor guide
Research direction
Start at crates/ruff_workspace/src/pyproject.rs around the linked line and reproduce the Ruff format command with a Nix-mapped config path. Trace how the config filename is classified, then check nearby tests for configuration format detection. Done means the reported mapped filename is handled consistently or the requested format selection is supported and covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100