Skip to content

Include the source filename in parse warnings - #758

Closed
kurunomochi wants to merge 1 commit into
theskumar:mainfrom
kurunomochi:fix/parse-warning-source
Closed

kurunomochi wants to merge 1 commit into
theskumar:mainfrom
kurunomochi:fix/parse-warning-source

Conversation

@kurunomochi

Copy link
Copy Markdown

When several dotenv files are loaded, a warning such as "could not parse statement starting at line 2" gives no indication which file to inspect. This addresses the diagnostic requested in #483. It uses the name of the stream actually parsed, so a missing path passed alongside a fallback stream cannot be reported as the source. The same diagnostic is used during reads and rewrites. Anonymous streams retain the line-only message, and no dotenv contents are logged.

Tests cover a file with both a valid and an invalid binding, and an anonymous fallback stream. On Windows with Python 3.13 the suite passed (242 passed, 52 skipped). Ruff lint and format checks passed, as did mypy on src.

Prepared with OpenAI Codex.

@kurunomochi

Copy link
Copy Markdown
Author

Hi @theskumar, this PR is ready for review! All CI checks are passing and there are no merge conflicts. It adds the source filename to the parse warnings as requested in #483. Could you please take a look when you have time? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant