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

pyproject.toml is ignored when passed via stdin #16950

Closed
InSyncWithFoo opened this issue Mar 24, 2025 · 2 comments · Fixed by #16971
Closed

pyproject.toml is ignored when passed via stdin #16950

InSyncWithFoo opened this issue Mar 24, 2025 · 2 comments · Fixed by #16971
Labels
bug Something isn't working

Comments

@InSyncWithFoo
Copy link
Contributor

This works:

$ cat pyproject.toml
[project]
name = 1

$ ruff check --isolated --select RUF200 pyproject.toml
pyproject.toml:2:8: RUF200 Failed to parse pyproject.toml: invalid type: integer `1`, expected a string
  |
1 | [project]
2 | name = 1
  |        ^ RUF200
  |

Found 1 error.

This doesn't:

$ ruff check --isolated --select RUF200 --stdin-filename pyproject.toml -
[project]
name = 1
All checks passed!

These two commands should work similarly.

@InSyncWithFoo
Copy link
Contributor Author

I think the server also doesn't report RUF200 when a pyproject.toml is opened either.

@MichaReiser
Copy link
Member

I think the server also doesn't report RUF200 when a pyproject.toml is opened either.

Yes, the server doesn't run on toml files

@MichaReiser MichaReiser added the bug Something isn't working label Mar 24, 2025
MichaReiser pushed a commit that referenced this issue Mar 27, 2025
## Summary

Resolves #16950 and [a 1.5-year-old TODO
comment](https://github.com/astral-sh/ruff/blame/8d16a5c8c98089b0d1be3e3fd68954be62dd2598/crates/ruff/src/diagnostics.rs#L380).

After this change, a `pyproject.toml` will be linted the same as any
Python files would when passed via stdin.

## Test Plan

Integration tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants