()
| 10 | |
| 11 | |
| 12 | def main(): |
| 13 | params = linter_params.get_params() |
| 14 | |
| 15 | if 'custom_clang_format' in params.extra_params: |
| 16 | dep_result = next( |
| 17 | ( |
| 18 | PurePath(params.depends[dep]) |
| 19 | for dep in params.depends |
| 20 | if str(PurePath(dep).parent) == params.extra_params['custom_clang_format'] |
| 21 | ), |
| 22 | None, |
| 23 | ) |
| 24 | if dep_result is None: |
| 25 | raise Exception('Could not find clang-format binary') |
| 26 | |
| 27 | if 'custom_clang_format_bin' in params.extra_params: |
| 28 | # dep_result is not a clang-format binary (package etc) |
| 29 | clang_format_binary = str(dep_result.parent / params.extra_params['custom_clang_format_bin']) |
| 30 | else: |
| 31 | # dep_result is a clang-format binary |
| 32 | clang_format_binary = str(dep_result) |
| 33 | else: |
| 34 | clang_format_binary = os.path.join(params.global_resources[CLANG_FORMAT_RESOURCE], 'clang-format') |
| 35 | |
| 36 | style_config_path = params.configs[0] |
| 37 | |
| 38 | report = reporter.LintReport() |
| 39 | for file_name in params.files: |
| 40 | start_time = time.perf_counter() |
| 41 | status, message = check_file(clang_format_binary, style_config_path, file_name) |
| 42 | elapsed = time.perf_counter() - start_time |
| 43 | report.add(file_name, status, message, elapsed=elapsed) |
| 44 | |
| 45 | report.dump(params.report_file) |
| 46 | |
| 47 | |
| 48 | def check_file(clang_format_binary, style_config_path, filename): |
no test coverage detected