Skip to content

Respect the end of line character of source files instead of clobbering it to the current platform's default #33

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

Merged
merged 2 commits into from
Sep 15, 2021

Conversation

CAM-Gerlach
Copy link
Contributor

Currently, docstrfmt arbitrarily converts the EoLs of any modified files to the default of whatever platform it happens to be running on, rather than properly respecting the EoL of the original file. Accordingly, this means users on Windows or other non-standard platforms that don't have their git settings set up to prevent this will clobber any file that docstrfmt modifies that they then check into the repo, converting it to non-standard CRLF (that will switch back and forth depending on the last platform to modify it) and modifying every line of the file, leading to a high chance of merge conflicts.

Like the previous issue, I ran into this on my PRAW PR and its a basic but unfortunately not uncommon mistake made by newer/smaller formatting tools that I've fixed for a number of others, so I figured I'd fix it and add some tests for it.

@CAM-Gerlach
Copy link
Contributor Author

Hey @LilSpazJoekp , could you review and approve the workflow run? Thanks!

Copy link
Owner

@LilSpazJoekp LilSpazJoekp left a comment

Choose a reason for hiding this comment

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

Nice catch!

@CAM-Gerlach
Copy link
Contributor Author

CAM-Gerlach commented Sep 15, 2021

@LilSpazJoekp Thanks! Looks like I missed a couple lines of test coverage; I tweaked the block to use getattr instead, which is both shorter/simpler and avoids the coverage issue.

@LilSpazJoekp LilSpazJoekp merged commit c0f566b into LilSpazJoekp:master Sep 15, 2021
@CAM-Gerlach
Copy link
Contributor Author

Thanks @LilSpazJoekp !

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.

2 participants