When I have an empty line in an indented block, should I
remove spaces,
have as many spaces as the indentation commands,
not care?
(This came up while cooperating with someone, I do (1). It leads to a bunch of gratuitious changes in git unless normalization is applied before commits).
Examples:
function f1(a)
b = a + 1
# ^ line above has no spaces
b
end
function f2(a)
b = a + 1
# ^ line above has 4 spaces
b
end
Runic.jl apparently does (1), but I don’t see it documented.
I do this automatically (VSCode does this for me automatically).
I thought Runic.jl did this as well during formatting, but it looks like it doesn’t by looking at the readme again (cc @fredrikekre if you wish to comment)
Every now and then I have a co-author, maybe in Julia code, maybe in TeX, not doing that. If it is just a few lines, I do commit that.
If that other person does not do that on purpose, this solves it. Before an “edit/commit war” starts, carefully look for a discussion. The one time I opened that discussion, the other person was simply not aware of the spaces – as like for your case in empty lines.
A lot of big projects demand there be no trailing whitespaces. The Julia repo itself does this through a quick CI check — by ensuring no trailing whitespace ever lands on master, it completely avoids the problem of the gratuitous git changes.
It can add one extra speed bump to contribution, but it’s an easy fix: encourage your collaborators to turn on their editor’s setting for this.