northwood-studios / LocalAdmin-V2

Second version of LocalAdmin for SCP: Secret Laboratory game.
MIT License
22 stars 20 forks source link

Fixed line endings setting in .editorconfig #79

Open KarlOfDuty opened 11 months ago

KarlOfDuty commented 11 months ago

All files in the repo have LF line endings but the editorconfig is set to CR/LF, I fix.

iamalexrouse commented 11 months ago

I don't see any issue with changing line endings since there hasn't been issues with builds.

KarlOfDuty commented 11 months ago

Again, this doesn't change anything. This just sets the config to what we are already using.

zabszk commented 11 months ago

I don't see any issue with changing line endings since there hasn't been issues with builds.

There is a potential issue. On linux git normalizes line endings to LF, so having editorconfig set to CRLF can cause all line endings to be changed by the IDE. However depending on the git config there might be a similar situation on windows when we set editorconfig to LF.

I'm still waiting for @MichalPetryka opinion, however it might be a better idea to change that in repo git config as well or don't set line ending in editorconfig at all, because git should normalize it anyway.

MichalPetryka commented 11 months ago

We've decided that it might be a better idea to force cloning as CRLF in .gitattributes and to normalize them in the repo instead.

KarlOfDuty commented 11 months ago

Why not just use LF...?

MichalPetryka commented 11 months ago

Why not just use LF...?

Visual Studio always uses CRLF and some other Windows tooling does too.

KarlOfDuty commented 11 months ago

LF should always work regardless of platform, CRLF will not. And Visual studio doesnt care about your line endings, we use exclusively LF at work and VS has never had any issues with that.

MichalPetryka commented 11 months ago

VS has never had any issues with that

It does have issues.

MichalPetryka commented 11 months ago

CRLF will not

And CRLF works everywhere too if you use normal tooling.

iamalexrouse commented 11 months ago

By default, I believe git can automatically convert line endings but I'm probably entirely wrong.

But what's the point in the first place?

zabszk commented 11 months ago

By default, I believe git can automatically convert line endings but I'm probably entirely wrong.

But what's the point in the first place?

That conversion is the entire point of this discussion. By default git converts it to LF on Linux and to either LF or CRLF depending on config on Windows. If the IDE uses CRLF and git converts to LF (or vice versa) you end with ton of automatically made changes by the IDE.

LF should always work regardless of platform, CRLF will not. And Visual studio doesnt care about your line endings, we use exclusively LF at work and VS has never had any issues with that.

There are windows tools that don't support LF. Even notepad (in a slightly older version, still commonly found) is a good example of that. I don't know a tool on linux that doesn't support CRLF (probably because CRLF contains LF, which is the default linux line ending).

Even what's happening on my PC is the perfect example. For me git autoconverts line endings to CRLF and when I changed the .editorconfig as you suggested and did a code cleanup in my IDE I ended with every line of code being changed. Just as you did on linux.