Skip to content

Line ending inconsistencies in cpp/arduino/avr/ files #283

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

Closed
jgfoster opened this issue Feb 15, 2021 · 7 comments · Fixed by #334
Closed

Line ending inconsistencies in cpp/arduino/avr/ files #283

jgfoster opened this issue Feb 15, 2021 · 7 comments · Fixed by #334

Comments

@jgfoster
Copy link
Member

On a fresh checkout on a new machine I get 266 files shown as modified. Further investigation shows that io+.h files have \r in them. I note that .gitattributes has * text eol=lf in it with a comment suggesting that this should make things consistent, but it doesn't.

Perhaps these files got copied/generated initially in a Windows format and were never fixed? In any case, following the instructions here seems to have fixed it. I'm not enough of an expert in Git line endings to know if this is the right solution, but I'll offer a PR for discussion.

@per1234
Copy link
Contributor

per1234 commented Feb 15, 2021

Even though there are many tools to check for this on a per-language basis (e.g., Prettier, eslint), I have always preferred to have a universal CI check for general formatting conventions that I want to apply to all (with some rare exceptions) files in the repository. I have traditionally done this with ungainly find commands, but just yesterday went on a hunt for something a bit better. I'm pretty happy with what I found:
https://github.com/editorconfig-checker/action-editorconfig-checker

@ianfixes
Copy link
Collaborator

I just noticed this too! I thought it was related to switching to a new computer (which had a bad file copy, requiring a re-sync of some files).

Locally I just did this and it seemed to work. I'll be pushing that up with other changes in a bit

diff --git a/.gitattributes b/.gitattributes
index 4282322..54bf8d2 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,2 +1,2 @@
 # Set the default behavior, in case people don't have core.autocrlf set.
-* text eol=lf
+* text=off

The fact that we're all experiencing this suddenly though makes me wonder if something else is at play

@jgfoster jgfoster mentioned this issue Feb 15, 2021
@prestoncarman
Copy link
Contributor

Just as a reminder. The .gitattributes option was added to in #215 as a result of a line ending issue during a CI build on windows.

@ianfixes
Copy link
Collaborator

ianfixes commented Apr 4, 2021

@prestoncarman does #285 satisfy your concerns here? If so I will likely cherry-pick it into my branch

@prestoncarman
Copy link
Contributor

It looks like this resolves the issue. The .gitattributes settings were added to appease one of the CI test when using windows. It appears the CI is not throwing a warning or error for line endings with these settings.

@ianfixes ianfixes added this to the 2021 Beta 1 Features milestone Apr 5, 2021
@hlovdal
Copy link
Contributor

hlovdal commented Apr 5, 2021

With pull request #286 merged, this issue can be closed.

@jgfoster
Copy link
Member Author

jgfoster commented Apr 5, 2021

Fixed by #286.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants