eclint icon indicating copy to clipboard operation
eclint copied to clipboard

eclint gets confused by multiple line ending

Open maxthiel opened this issue 6 years ago • 2 comments
trafficstars

When trying to fix a file that contains multiple type of line ending, eclint appears to get confused and remove a lot of content.

original Content of the file:

using my.name.space;



namespace my.other.name.space

{

    public class MyClass : IMyInterface { }

    public class MyOtherClass : IMyInterface { }

    public class MyOtherOtherClass : IMyInterface { }
}


As you can see, copy pasting from notepad++ to github already messes with things. Note that the file is also in UTF-8 + bom.

The .editorConfig is set this way:

[*]
indent_style = space
indent_size = 4
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

When doing eclint check the result are as follow:

testClass.cs
    01:01 ❌️ invalid charset: utf-8-bom, expected: utf-8
                                                         (EditorConfig charset                  https://goo.gl/hK94EO)
    01:01 ❌️ unexpected trailing whitespace             (EditorConfig trim_trailing_whitespace https://goo.gl/oo8iVb)
    02:01 ❌️ unexpected trailing whitespace             (EditorConfig trim_trailing_whitespace https://goo.gl/oo8iVb)
    03:01 ❌️ unexpected trailing whitespace             (EditorConfig trim_trailing_whitespace https://goo.gl/oo8iVb)
    06:01 ❌️ unexpected trailing whitespace             (EditorConfig trim_trailing_whitespace https://goo.gl/oo8iVb)
    07:01 ❌️ unexpected trailing whitespace             (EditorConfig trim_trailing_whitespace https://goo.gl/oo8iVb)
    09:01 ❌️ unexpected trailing whitespace             (EditorConfig trim_trailing_whitespace https://goo.gl/oo8iVb)

When doing eclint fix the fixed file looks like this: fixed

The code itself:




{



    public class MyOtherOtherClass : IMyInterface { }

Attaching the files as well: eclint_crlf_issue.zip

maxthiel avatar May 16 '19 10:05 maxthiel

end_of_line = crlflocal vm)

That doesn't look like a valid option. From editorconfig.org "end_of_line: set to "lf", "cr", or "crlf" to control how line breaks are represented."

nschonni avatar May 16 '19 15:05 nschonni

Indeed, thanks for spotting it! That was a typo in my comment, the editorConfig was configured with crlf.

maxthiel avatar May 16 '19 15:05 maxthiel