Check file content to see if it looks auto-generated

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
Dave Rodgman 2024-03-18 11:15:06 +00:00
parent 78064ac9e0
commit 2a9eb22107

View File

@ -51,6 +51,12 @@ def list_generated_files() -> FrozenSet[str]:
checks = re.findall(CHECK_CALL_RE, content)
return frozenset(word for s in checks for word in s.split())
# Check for comment string indicating an auto-generated file
AUTOGEN_RE = re.compile(r"Warning[ :-]+This file is (now )?auto[ -]generated", re.ASCII | re.IGNORECASE)
def is_file_autogenerated(filename):
content = open(filename, encoding="utf-8").read()
return AUTOGEN_RE.search(content) is not None
def get_src_files(since: Optional[str]) -> List[str]:
"""
Use git to get a list of the source files.
@ -85,7 +91,8 @@ def get_src_files(since: Optional[str]) -> List[str]:
# generated files (we're correcting the templates instead).
src_files = [filename for filename in src_files
if not (filename.startswith("3rdparty/") or
filename in generated_files)]
filename in generated_files or
is_file_autogenerated(filename))]
return src_files
def get_uncrustify_version() -> str: