UltraStar-Deluxe / Play

Free and open source singing game with song editor for desktop, mobile, and smart TV
https://ultrastar-play.com
MIT License
395 stars 73 forks source link

The project has mixed line endings, and that's bad #489

Open AnsisMalins opened 1 week ago

AnsisMalins commented 1 week ago

Issue type: Development discussion

Problem or question to be solved

Some files and lines with LF (example: SongLibraryOptionsSceneControl.cs), others end lines with CRLF (example: FileSystemDialogUtils.cs). Visual Studio is unable to consistently switch between different line endings one a per file basis. This causes diffs where the whole file changed. But also, mixed line endings are just plain rude.

Suggested solution/s

Pick one, reformat all files to it, and add an editorconfig rule to enforce it.

Your opinion on the topic

I would go with LF because it's more popular in the open source world, and anyway, Windows will be dead soon. :^)

achimmihca commented 6 days ago

I agree, mixed line endings are annoying.

I found that Unity creates its auto generated files with \r\n line endings. Probably on macOS and Linux, Unity auto generates files with \n line endings. Can you confirm this?

Furether, the current custom code generation (e.g. RMessages.cs) just uses \n. We could adjust this.

Note that Git can convert between line endings, see core.autocrlf. This option is set to true on my system, so I might check out files as \r\n but all files that I commit should use \n. Weird that some files on your system have a different line ending.

Anyway, I don't have a strong opinion on this, would prefer \n. Feel free to adjust this.

AnsisMalins commented 5 days ago

I do not understand how autocrlf is not mega, giga evil. When I checkout, I expect to receive exactly what's in the repo, byte for byte, and the same when committing. Furthermore, autocrlf breaks any tools that compare files, calculate their hashes, and so on.

basisbit commented 5 days ago

autocrlf is a standard thing and as far as I know, all projects I contribute do also use it.. @AnsisMalins what git client are you using, that you have any issue with this at all?

AnsisMalins commented 5 days ago

I'm using Git and GitExtensions. If autocrlf is the law then I will obey and turn it on for this repo.