Skip to content

Different errors being reported on the same file depending on whether parsing from stdin or not #6627

@bryanforbes

Description

@bryanforbes

Given the following file named foo.pyi:

from pathlib import Path

def get_home_directory() -> Path: ...

ruff reports different errors depending on whether it's being parsed from stdin. The following reports no errors:

ruff --force-exclude --no-cache --no-fix --quiet --format json --isolated --select TCH asyncpg-stubs/compat.pyi

And the following reports an error in the first line:

cat foo.pyi | ruff --force-exclude --no-cache --no-fix --quiet --format json --isolated --select TCH --stdin-filename path/to/foo.pyi -

The reason this is coming up is because ruff-lsp runs ruff similar to how the second command runs and is reporting errors in my stubs project.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions