Skip to content

align files to .editorconfig #203

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

Merged
merged 2 commits into from
Sep 27, 2018
Merged

Conversation

tg123
Copy link
Member

@tg123 tg123 commented Sep 21, 2018

eclint fix **/*.cs

check will integrate with CI process

#37

@gitfool

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tg123
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: brendandburns

If they are not already assigned, you can assign the PR to them by writing /assign @brendandburns in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 21, 2018
@gitfool
Copy link

gitfool commented Sep 21, 2018

@tg123 I didn't know about eclint. Nice!

I see all the line endings are still CRLF though, despite the .editorconfig specifying LF. When editing an existing file it seems the existing EOL is preserved. However, when creating a new file (in VS 2017 at least) it will use LF, so either .editorconfig should be changed to specify CRLF or the EOL should be changed to LF for all existing files.

@tg123
Copy link
Member Author

tg123 commented Sep 21, 2018

@gitfool
only eclint with *.cs
and generated codes are ignored

@gitfool
Copy link

gitfool commented Sep 21, 2018

I ran the same command as you on your branch, eclint fix **/*.cs, and all cs files were further updated, as expected, to use LF for EOL. So you must've passed CRLF on the command-line to eclint; but this has the problem I mention above.

@tg123
Copy link
Member Author

tg123 commented Sep 21, 2018

@gitfool I checked all .cs are LF except /src/KubernetesClient/generated/
for generated they should be handled by autorest.

my command

find . -name *.cs -exec file {} \; | grep CRLF | grep -v generated

@gitfool
Copy link

gitfool commented Sep 21, 2018

Right. If I clone your repo in WSL then I get LF. If I clone in Windows then I get CRLF. The problem is that because there's no .gitattributes file, it depends on everyone's git client settings. If I edit an existing file on Windows it will be committed using CRLF.

The other approach is to remove the end_of_line entry from .editorconfig and add a .gitattributes file. See dealing-with-line-endings and the gitattributes repo for some relevant templates. If specified correctly then text files will match the os platform when editing but always be stored in git using LF.

@tg123
Copy link
Member Author

tg123 commented Sep 21, 2018

@gitfool you may be a victim of autocrlf

@gitfool
Copy link

gitfool commented Sep 21, 2018

Haha. I've been the victim of many EOL abuses. The point is everyone has their own settings and you can't expect them to comply with your settings, so the best way to address this is with a .gitattributes file in the repo. This and .gitignore should be the first files added to a new repo. When added late you have to renormalize line endings which can make a mess of the repo history.

@tg123
Copy link
Member Author

tg123 commented Sep 21, 2018

@gitfool after fully eclint (or some other solution) integrated.
bad line ending will be blocked from merging to master see #37

@gitfool
Copy link

gitfool commented Sep 21, 2018

That's all very well, and is one way to lock things down, but again you've missed the point. You're only considering what you use. A .gitattributes file is particularly important for cross-platform projects where developers will use different tools on different operating systems. I give up.

@tg123
Copy link
Member Author

tg123 commented Sep 21, 2018

@gitfool thanks I see, that is a good idea.
You can create a PR for that

@gitfool
Copy link

gitfool commented Sep 21, 2018

Cool. Will do after this is PR merged, since they'll overlap.

@brendandburns
Copy link
Contributor

LGTM.

@brendandburns brendandburns merged commit 9372e32 into kubernetes-client:master Sep 27, 2018
@tg123 tg123 deleted the eol branch February 5, 2019 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants