mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-14 00:37:44 -04:00
ci: core_checker: Match copyright line with regex
Allow for a variety of copyright dates by matching copyright statements with a regex.
This commit is contained in:
parent
8f21b61908
commit
0048a568c9
2 changed files with 12 additions and 2 deletions
10
.github/scripts/common/header_checker.py
vendored
10
.github/scripts/common/header_checker.py
vendored
|
@ -67,10 +67,13 @@ class HeaderChecker:
|
|||
py_ext=None,
|
||||
asm_ext=None,
|
||||
third_party_patterns=None,
|
||||
copyright_regex = None
|
||||
):
|
||||
self.padding = padding
|
||||
self.header = header
|
||||
|
||||
self.copyright_regex = re.compile(copyright_regex)
|
||||
|
||||
# Construct mutated header for assembly files
|
||||
self.asm_header = [";" + line for line in header]
|
||||
|
||||
|
@ -124,7 +127,12 @@ class HeaderChecker:
|
|||
def isValidHeaderSection(self, file_ext, section_name, section):
|
||||
"""Validate a given section based on file extentions and section name"""
|
||||
valid = False
|
||||
if file_ext in self.pyExtList:
|
||||
if self.copyright_regex and section_name == "copyright":
|
||||
valid = True
|
||||
for line in section:
|
||||
if not self.copyright_regex.match(line):
|
||||
valid = False
|
||||
elif file_ext in self.pyExtList:
|
||||
valid = self.headers_py[section_name] == section
|
||||
elif file_ext in self.asmExtList:
|
||||
valid = self.headers[section_name] == section
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue