Skip to content

Warning for consecutive lines that are comments #223

Closed

Description

@Harmon758

With #211 (v0.10.4), if there are consecutive lines that are comments, there will be a warning for each line after the first. because key and value will be None, passing the check for the warning. The only reason the first line does not have a warning is because it is considered as part of the line before, since the regular expression for comments captures any whitespace, including newlines, at the beginning.

Activity

  1. self-assigned this
    on Jan 18, 2020
  2. bbc2 commented on Jan 18, 2020

    @bbc2
    Collaborator

    Thank you so much for reporting this. It's indeed an issue and I think there would even be an unwanted warning with just one comment-only line. I'm hoping that #224 will fix this.

  3. Harmon758 commented on Jan 18, 2020

    @Harmon758
    Author

    Currently, just one comment-only line doesn't prompt a warning, for the same reason the first line in consecutive lines of comments doesn't. That is, it's captured when the line before the comment line is parsed, because the regular expression for comments captures the newline between the two lines.

  4. bbc2 commented on Jan 19, 2020

    @bbc2
    Collaborator

    I think I see what you mean:

    a=b
    # comment
    # comment
    
    Python-dotenv could not parse statement starting at line 3
    {'a': 'b'}
    

    But I found out that just the following also causes a warning:

    # comment
    
    Python-dotenv could not parse statement starting at line 1
    {}
    

    Anyway, I think I fixed it with the latest MR. And I've also avoided the capture of newlines preceding comments so that debugging is easier.

  5. Harmon758 commented on Jan 19, 2020

    @Harmon758
    Author

    That's what I meant, yeah. Thanks!

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions