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

Correctly ignore comment lines #15

Closed
wants to merge 1 commit into from
Closed

Correctly ignore comment lines #15

wants to merge 1 commit into from

Conversation

wwuck
Copy link
Contributor

@wwuck wwuck commented Feb 6, 2020

Correctly ignore comment lines following a line continuation character at the end of the previous line.

Fixes #14

Correctly ignore comment lines following a line continuation character at the end of the previous line.

Fixes #14
@@ -73,6 +73,8 @@ def joinlines(lines):
joined_line = ""
for line in map(lambda x: x.strip(), lines):
if not line or line.startswith("#"):
yield joined_line
joined_line = ""
continue
if line.endswith("\\"):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if-blocks on 75 and 79 lines could be swapped which would fix the issue, the same as pip does.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are righ, that would make flake8-requirements work like pip. But there is a documentation for requirements.txt file which explicitly says "comments are stripped before line continuations are processed". So either documentation is wrong, or pip implementation....

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just saw the talk on pypa/pip, so when the issue pypa/pip/issues/7728 will be answered, I will follow accordingly :)

@wwuck
Copy link
Contributor Author

wwuck commented May 14, 2020

Any changes I need to make to this PR @arkq, or will you fix it in a new commit ?

@arkq arkq closed this in 41eed2e May 14, 2020
arkq added a commit that referenced this pull request May 14, 2020
Correctly ignore comment lines following a line continuation
character at the end of the previous line.

Fixes #14 and closes #15

Co-authored-by: Arkadiusz Bokowy <arkadiusz.bokowy@gmail.com>
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.

Incorrect parsing of comment lines following a line continuation
3 participants