-
-
Notifications
You must be signed in to change notification settings - Fork 378
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
Add pre-commit hook for cleaning up mixed-line endings #2679
Add pre-commit hook for cleaning up mixed-line endings #2679
Conversation
This reverts commit 7b9670f.
Hmm, isn't there a git setting that sorts this out for you? Something with |
yeah
So maybe add a precommit hook to enforce it is not a bad idea |
@@ -1,162 +1,162 @@ | |||
{-# LANGUAGE DerivingVia #-} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omg all those files had incorrect line endings???? 🤦
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, as described in the issue: #2678
"args": ["--fix", "lf"], | ||
"exclude": "test/testdata/.*CRLF*.hs$" | ||
} | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about create a .pre-commit-config.json
in the repo to make a little bit more easier and discoverable? docs could link to the file in that case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do that as well!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although, the pre-commit hook is part of .gitignore
. I can envision some users use their own personal pre-commit hook and having one in source control may cause issues?
otoh you have to remember install the hook, like you have to remember install the plugin to honour our existing enforcing mechanism, .editorconfig 🤷 the advantage of the hook is it is applied always for sure (once is installed), even if you editor (notepad?? :-P) does not have support for .editorconfig |
What about fix the formatting existing hook to make it use LF in its formatting (or at least not change them to CRLF!!!)? we would have the two features with one hook |
Ooo I didn't realize |
Special thanks for converting those files to the initial line ending. Converting back - would solve Git diff rebases. I thought that is the first thing to do on return, before thinking further, it is already done here. Thank you. |
not sure if it could modify line endings but it should not change the existing ones, like it is doing for me lf -> crlf |
@@ -32,7 +32,7 @@ test/testdata/**/hie.yaml | |||
.shake/ | |||
|
|||
# pre-commit-hook.nix | |||
.pre-commit-config.yaml | |||
#.pre-commit-config.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to put the config into nix setting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't use nix so I have no idea, any help would be appreciative.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nix doesn't support windows so I suppose it is not necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
Figured I'd offer a solution for #2678. I don't use nix so I'm not sure if there is anything that needs to be done to integrate in nix (also not sure if it's even necessary). Most of the file commits are the line endings with a few interspersed stylish-haskell changes.