copyright: do not add extra blank line (#2502)

This commit is contained in:
Gary Verhaegen 2019-08-13 11:52:07 +01:00 committed by Moritz Kiefer
parent c2e2e007e7
commit 7363d73500

View File

@ -126,6 +126,7 @@ def process_file(filename, check_only):
lines = fp.readlines()
# Pretend that the file has extra empty line at the end to handle files,
# which consist only of the copyright notice and nothing else.
# label: ADD_BLANK_LINE
lines.append('\n')
# Process the file:
@ -209,7 +210,8 @@ def process_file(filename, check_only):
# copyright header existed, but was out of date, replace it.
fp.write("".join(before_header))
fp.write(header)
fp.write("".join(after_header))
# remove additional blank line added at ADD_BLANK_LINE
fp.write("".join(after_header[:-1]))
elif 'skip' in filetypes[ext]:
# no copyright header, but file type requires skipping lines
skip_prefix = filetypes[ext]['skip']