Add code formatting rule to add newlines at the end of code files#127
Add code formatting rule to add newlines at the end of code files#127dsplaisted wants to merge 4 commits intodotnet:mainfrom
Conversation
|
Thanks for the pointer to #61 @khellang. Based on reading the discussion there, I've fixed the rule for cases where there are comments or compiler directives at the end of the file. For simplicity, this PR merely makes sure that the file ends with a newline (in contrast with #61). It doesn't try to prevent it from ending with multiple newlines. |
|
Ahh i just implemented this before seeing this PR :) @dsplaisted: Can you rebase these commits, it's difficult to code review with context in different commits. |
|
Won't this conflict with the standard formatter rule? The formatter by default will delete new lines at the end of the file. |
|
Note that this is only required in case of CRLF on Windows. If you are using LF in editor, extra linefeed will persist in diff, which means git doesn't require additional line-break. I think git converts (in corefx repository, .gitattributes is present, but almost never used: all rules are commented out) Note, git only apply the .gitattributes rules on |
@stephentoub has pointed out that text files should end with a newline. This PR adds a code formatting rule to do this for C# source code files.