Sed
Remove consecutive blank lines with
sedbefore commiting codeI work as an SRE. And part of my job is to write
terraformInfrastructure 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
terraformhas thefmtcommand 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
gitcommit ever contains such a thing, ever.
1 / 1