Skip to content

Commit 1171353

Browse files
committed
Fix header check
Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
1 parent 624e0e2 commit 1171353

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

.github/scripts/kernel_checker.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@
156156

157157
FREERTOS_ARM_COLLAB_COPYRIGHT_REGEX = r"(^(;|#)?( *(\/\*|\*|#|\/\/))? Copyright \(C\) 20\d\d Amazon.com, Inc. or its affiliates. All Rights Reserved\.( \*\/)?$)|" + \
158158
r"(^(;|#)?( *(\/\*|\*|#|\/\/))? Copyright 20\d\d(-20\d\d)? Arm Limited and/or its affiliates( +<open-source-office@arm\.com>)?( \*\/)?$)|" + \
159+
r"(^(;|#)?( *(\/\*|\*|#|\/\/))? Copyright \(c\) 20\d\d(-20\d\d)? Arm Technology \(China\) Co., Ltd.All Rights Reserved\.( \*\/)?$)|" + \
159160
r"(^(;|#)?( *(\/\*|\*|#|\/\/))? <open-source-office@arm\.com>( \*\/)?$)"
160161

161162

@@ -198,6 +199,8 @@ def checkArmCollabFile(self, path):
198199
]
199200
if (len(lines) > 0) and (lines[0].find("#!") == 0):
200201
lines.remove(lines[0])
202+
if (len(lines) > 0) and (len(lines[-1].strip()) == 0):
203+
lines.remove(lines[-1])
201204

202205
# Split lines in sections.
203206
headers = dict()
@@ -215,8 +218,10 @@ def checkArmCollabFile(self, path):
215218
text_equal = self.isValidHeaderSection(file_ext, "text", headers["text"])
216219
spdx_equal = self.isValidHeaderSection(file_ext, "spdx", headers["spdx"])
217220

218-
if text_equal and spdx_equal and len(headers["copyright"]) == 3:
219-
isValid = True
221+
if text_equal and spdx_equal:
222+
# Some files do not have "open-source-office@arm.com" line.
223+
if len(headers["copyright"]) == 3 or len(headers["copyright"]) == 2:
224+
isValid = True
220225

221226
return isValid
222227

0 commit comments

Comments
 (0)