Commit ccc2eb5d authored by David Gobbi's avatar David Gobbi

Call reindent() until no further changes occur

Six files in the VTK source required vtk_reindent_code.py to be called
twice in order for the indentation to be corrected (all other files only
required it to be called once).  The problem with those six files was
nested blocks where all source lines between the beginning of the outer
block and the beginning of the inner block were comments.  There is
probably a way to fix the script so that it properly deals with this
situation, but simply re-processing the file until no futher changes
occur is a robust solution that gives the correct result.
parent d978f250
Pipeline #18286 passed with stage
......@@ -273,9 +273,14 @@ def reindent(filename):
ofile = open(filename, 'w')
ofile.writelines(lines)
ofile.close()
return True
return False
if __name__ == "__main__":
for filename in sys.argv[1:]:
reindent(filename)
# repeat until no further changes occur
while reindent(filename):
pass
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment