Sed
Remove consecutive blank lines with
sed
before commiting codeI work as an SRE. And part of my job is to write
terraform
Infrastructure as Code to maintain and develop the company’s cloud offers.My colleagues and I were planing some code refactoring. And we wanted to somewhat raise the code-quality level. Part of this was to enforce some formatting rules. And, while
terraform
has thefmt
command which can recursively reformat code, it fails at fixing the no consecutive blank lines rule we wanted to enforce.Now, we’re all grown-ups here and we know this is not a task to be achieved by hand. Not only it’s tedious but also error-prone. It has to be automated so that no
git
commit ever contains such a thing, ever.
1 / 1