(folder, strategy="git-head", file_list=None)
| 165 | class CopyrightCheckRun: |
| 166 | @staticmethod |
| 167 | def get_files(folder, strategy="git-head", file_list=None): |
| 168 | shell = Shell() |
| 169 | shell.cd(folder) |
| 170 | skip_copyright = skip_copyright_global |
| 171 | |
| 172 | # Check if author e-mail is in arm.com domain |
| 173 | author_email_cmd = "git config --get user.email" |
| 174 | author_email = shell.run_single_to_str(author_email_cmd).strip() |
| 175 | |
| 176 | if not author_email.endswith("@arm.com"): |
| 177 | skip_copyright = True |
| 178 | |
| 179 | if file_list == None: |
| 180 | if strategy == "git-head": |
| 181 | raw_file_list = shell.run_single_to_str("git diff-tree --no-commit-id --name-status -r HEAD | grep \"^[AMRT]\" | cut -f 2") |
| 182 | elif strategy == "git-diff": |
| 183 | raw_file_list = shell.run_single_to_str("git diff --name-status --cached -r HEAD | grep \"^[AMRT]\" | rev | cut -f 1 | rev") |
| 184 | else: |
| 185 | raw_file_list = shell.run_single_to_str("git ls-tree -r HEAD --name-only") |
| 186 | # Skip copyright checks when running on all files because we don't know when they were last modified |
| 187 | # Therefore we can't tell if their copyright dates are correct |
| 188 | skip_copyright = True |
| 189 | |
| 190 | file_list = raw_file_list.split("\n") |
| 191 | |
| 192 | folder_pattern = re.compile(r"^(arm_compute|src|examples|tests|utils|support)/") |
| 193 | extension_pattern = re.compile(r"\.(cpp|h|hh|inl|cl|cs|hpp)$") |
| 194 | |
| 195 | list_files = [ f for f in file_list if folder_pattern.search(f) and extension_pattern.search(f)] |
| 196 | |
| 197 | # Check for scons files as they are excluded from the above list |
| 198 | scons_pattern = re.compile(r"SC") |
| 199 | list_files += [ f for f in file_list if scons_pattern.search(f)] |
| 200 | |
| 201 | return (list_files, skip_copyright) |
| 202 | |
| 203 | def __init__(self, files, folder, error_diff=False): |
| 204 | self.files = files |
no test coverage detected