@@ -57,17 +57,23 @@ def get_header_options(
5757
5858 # Header build
5959 year_options = [f"{ current_year } " ] + [f"{ year } -{ current_year } " for year in range (starting_year , current_year )]
60+ # last element is the example for the error message
61+ year_options .append (f"{ current_year } " if starting_year == current_year else f"<FILE_CREATION_YEAR>-{ current_year } " )
6062 copyright_notices = [[f"# Copyright (C) { year_str } , { owner } .\n " ] for year_str in year_options ]
6163
62- return [
63- [* SHEBANG , BLANK_LINE , * copyright_notice , BLANK_LINE , * license_notice ]
64- for copyright_notice in copyright_notices
65- for license_notice in license_notices
66- ] + [
67- [* copyright_notice , BLANK_LINE , * license_notice ]
68- for copyright_notice in copyright_notices
69- for license_notice in license_notices
70- ]
64+ return (
65+ [
66+ [* SHEBANG , BLANK_LINE , * copyright_notice , BLANK_LINE , * license_notice ]
67+ for copyright_notice in copyright_notices [:- 1 ]
68+ for license_notice in license_notices
69+ ]
70+ + [
71+ [* copyright_notice , BLANK_LINE , * license_notice ]
72+ for copyright_notice in copyright_notices [:- 1 ]
73+ for license_notice in license_notices
74+ ]
75+ + [[* copyright_notices [- 1 ], BLANK_LINE , * license_notices [0 ]]]
76+ )
7177
7278
7379def main (args ) -> None :
@@ -89,7 +95,7 @@ def main(args) -> None:
8995 if source_path .name in ignored_files or any (folder in source_path .parents for folder in ignored_folders ):
9096 continue
9197 # Parse header
92- header_length = max (len (option ) for option in header_options )
98+ header_length = max (len (option ) for option in header_options [: - 1 ] )
9399 current_header = []
94100 with source_path .open () as f :
95101 for idx , line in enumerate (f ):
@@ -99,7 +105,7 @@ def main(args) -> None:
99105 # Validate it
100106 if not any (
101107 "" .join (current_header [: min (len (option ), len (current_header ))]) == "" .join (option )
102- for option in header_options
108+ for option in header_options [: - 1 ]
103109 ):
104110 invalid_files .append (source_path )
105111
0 commit comments