Skip to content

fix: ignore comment lines at end of file in CSV parser #396

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

DCjanus
Copy link

@DCjanus DCjanus commented Apr 27, 2025

This pull request fixes an issue in the CSV parser where comment lines at the end of a file were not properly ignored.
According to expected behavior, if the last line(s) of a CSV file are comments (e.g., start with #), they should not be treated as data records, even if they appear at the end of the file without a trailing newline.

Fix: #363

This is my first contribution to this project. If there are any issues with my implementation, code style, or the contribution process, please let me know. I am happy to make any necessary changes and appreciate your guidance. Thank you for your time and consideration!

DCjanus added 5 commits April 27, 2025 23:34
This test reproduces issue BurntSushi#363, ensuring that comments at the end of the input data are properly ignored by the CSV reader.
Refines the test for ignoring comments at the end of the input data by removing the second record assertion, ensuring that only relevant records are processed. This addresses the behavior outlined in issue BurntSushi#363.
Refines the logic to ensure comments at the end of the file are ignored, addressing issue BurntSushi#363. Additionally, updates the test to validate this behavior.
Introduces a new test case to validate that comments at the end of the file are properly ignored, enhancing the coverage of the existing comment handling logic.
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.

Failure to parse content when last line is a comment.
1 participant