Something is bugging me for quite a while, it may sound silly but it breaks my flow because I have to correct whonix indentation, and change my editor indentation to 3 only for whonix file just doesn’t work if you are not always working with whonix only files.
Currently whonix is using 3 spaces for indentation, it is not standard to use an odd number. I also don’t know of anyone who manually indents to 3 spaces, they either indent to 2 or 4 or 8, so my guess is that past and present developers use(d) their editor configuration to set 3 spaces for indentation.
Can this be corrected by the great search and replace to all whonix files?
Pattern tor search for is ^ .* for the first degree of indentation and adding 3 spaces for other levels of indentation.
grep --color=auto "^ .*" /usr/bin/whonix-gateway-firewall, of literally any whonix file and you will see it is using 3 spaces for indentation.
It fails for example on whonix-firewall debian/whonix-firewall.postinst. Hard to explain. But the indent style is messed up. Easy to reproduce and see.
Do we need to invent a sed script here? Isn’t there some existing tool for code reformatting?
If there’s a reliable re-formatting method (specialized tool, sed, script, …), I am happy to do it project wide.
Until then, for anyone who modifies any scripts, feel free to change indentation to 2 spaces. However, change of indentation level (except for trivial scripts) needs to be in a separate commit to make it easier to review. (Not good to mix complex code changes with script wide indentation level changes.)
The above is for formatting from the command line.
For the future, during development, editing files, I recommend https://editorconfig.org/ and use an editor that support editorconfig (many does), with this, when saving the file, editorconfig will correct the format.