This repository has been archived by the owner on Dec 21, 2023. It is now read-only.
Format C# files with spaces and POSIX compliance #52
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is split into 3 commits:
The first commit formats C# files for POSIX compliance, with a newline at EOF and correct line endings. This improves compatibility with tools that expect POSIX compliance, and GitHub shows a "No newline at end of file" warning if the newline at EOF is missing. Additionally, some tools will automatically fix these problems (I have my editors configured for this when possible), so this makes it easier to use those tools on this project without generating diffs. In this commit I also added a
.gitattributes
file so that Git should automatically fix line ending problems in the future.The second commit replaces tabs with 4 spaces. The C# indent style is to use 4 spaces, plus the
.editorconfig
already says to do this, but some files were using tabs, or had an inconsistent style. For example, I see this if I opensrc/Microsoft.Maui.Graphics/Color.cs
on GitHub configured to show tabs as 8 characters wide:I considered opening an issue first, but I figured it was easier to just open a pull request. There is already a
.editorconfig
that says to use spaces, so I know it's desired, yet many files in this repo aren't doing that.I didn't format non-
.cs
files in this PR, since.cs
files are the bulk of this repo, it makes sense to do the.cs
ones separately from the rest. I can format other files in a future PR if desired.