It is valid for for a requirements.txt file to have lines with trailing comments:
foo>=1.2.3 # very informative comment
Right now we properly filter for lines that begin with comments but we also need to strip any trailing comments before parsing the requirement. This logic occurs here:
|
dependencies = set(line.strip() for line in lines if not line.startswith("#")) |
The logic above properly strips whitespace and filters lines that begin with comments but does not properly account for trailing comments.
We need to:
- Add a good test case
- Update the parser to handle these kinds of lines
It is valid for for a
requirements.txtfile to have lines with trailing comments:Right now we properly filter for lines that begin with comments but we also need to strip any trailing comments before parsing the requirement. This logic occurs here:
codemodder-python/src/codemodder/project_analysis/file_parsers/requirements_txt_file_parser.py
Line 31 in 2cdc91c
The logic above properly strips whitespace and filters lines that begin with comments but does not properly account for trailing comments.
We need to: