Content-Length: 279928 | pFad | http://github.com/pre-commit/pre-commit-hooks/pull/1257

7C Allow sorting file contents on windows machines by TomsCodingCode · Pull Request #1257 · pre-commit/pre-commit-hooks · GitHub
Skip to content

Allow sorting file contents on windows machines#1257

Closed
TomsCodingCode wants to merge 1 commit into
pre-commit:mainfrom
TomsCodingCode:main
Closed

Allow sorting file contents on windows machines#1257
TomsCodingCode wants to merge 1 commit into
pre-commit:mainfrom
TomsCodingCode:main

Conversation

@TomsCodingCode

Copy link
Copy Markdown

I ran into this issue, because in one of our CI/CD pipeline's we run the pre-commit checks on a windows image, which would result in a puzzling output from the file_contents_sorter hook.

Before the hook would perform a .rstrip(b'\n\r') on all lines, removing the CR character, and then join the lines together, only using '\n', resulting in white space differences that are hard to spot.

With this PR the newline sequence of the first line is used to determine how to strip and join the lines before and after sorting.

Added unit tests to ensure consistent behaviour on windows.

@asottile

asottile commented Jun 1, 2026

Copy link
Copy Markdown
Member

this feature has been declined already. you can read the discussion and recommendations if you search the issue tracker for it

@asottile asottile closed this Jun 1, 2026
@pre-commit pre-commit locked as resolved and limited conversation to collaborators Jun 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/pre-commit/pre-commit-hooks/pull/1257

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy