Skip to content

Use standard line ending in examples #2

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
wants to merge 1 commit into from

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Dec 10, 2023

Previously, some of the example sketch files used "CR" ("carriage return") line endings.

This line ending was standard in the classic "Mac OS" operating system (note this is different from the modern macOS). Apple switched to a POSIX-compliant operating system and "LF" ("line feed") line endings in 2001 with the release of OS X 10.0. Linux has always used "LF" line endings. Although Windows has historically used "CRLF" as the native line ending, "LF" is well supported (far more so than "CR"). For this reason, "LF" line endings are the standard for Arduino projects and software projects in general.

The use of the obsolete and non-standard "CR" line endings might cause difficulty for users working with the sketches in applications that don't have full support for "CR" line endings (example). It also might cause difficulties for contributors to the sketch code and for the project maintainers reviewing those contributions. For example, the GitHub web interface does not recognize these line endings and so displays the entire sketch as a single long line of code:

https://github.com/arduino-libraries/CTC-Go-Motions-Expansion/blob/4d5d89aee1fdf9dee7592a27173c2e351576de29/examples/Projects/SpinAWheel/spinAWheel_Stage1/spinAWheel_Stage1.ino

image

And the diff view for these files is quite unpleasant:

85c1056#diff-e01fd5adba854647f0da888d7aa964859a29e502f2e75a31d02eb3e6e9b82ad7

image

This pull request replaces the obsolete and inconsistent "CR" line endings with standard "LF" line endings.


Originally reported by @ElEstes at 85c1056#commitcomment-134605642

Previously, some of the example sketches used "CR" ("carriage return") line endings.

This line ending was standard in the "Mac OS" operating system. Apple switched to a POSIX-compliant operating system and "LF" ("line feed") line endings in 2001 with the release of OS X 10.0. Linux has always used "LF" line endings. Although Windows has historically used "CRLF" as the native line ending, "LF" is well supported (far more so than "CR"). For this reason, "LF" line endings are the standard for Arduino projects and software projects in general. The use of the obsolete and non-standard "CR" line endings might cause difficulty for users working with the sketches in applications that don't have full support for "CR" line endings. It also might cause difficulties for contributors to the sketch code and for the project maintainers reviewing those contributions.

The obsolete and inconsistent "CR" line endings are hereby replaced with standard "LF" line endings.
@per1234 per1234 closed this by deleting the head repository Apr 2, 2025
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.

1 participant