|
84 | 84 | "--version",
|
85 | 85 | default="10",
|
86 | 86 | help="The desired version of the clang tools to use. Accepted options are strings "
|
87 |
| - "which can be 6.0, 7, 8, 9, 10, 11, 12. Defaults to %(default)s.", |
| 87 | + "which can be 8, 9, 10, 11, 12, 13, 14. Defaults to %(default)s. On Windows, this " |
| 88 | + "can also be a path to the install location of LLVM", |
88 | 89 | )
|
89 | 90 | cli_arg_parser.add_argument(
|
90 | 91 | "-e",
|
|
107 | 108 | help="Set this option with paths to ignore. In the case of multiple "
|
108 | 109 | "paths, you can set this option (multiple times) for each path. This can "
|
109 | 110 | "also have files, but the file's relative path has to be specified as well "
|
110 |
| - "with the filename.", |
| 111 | + "with the filename. Prefix a path with '!' to explicitly not ignore it.", |
111 | 112 | )
|
112 | 113 | cli_arg_parser.add_argument(
|
| 114 | + "-l", |
113 | 115 | "--lines-changed-only",
|
114 | 116 | default="false",
|
115 | 117 | type=lambda input: input.lower() == "true",
|
116 | 118 | help="Set this option to 'true' to only analyse changes in the event's diff. "
|
117 | 119 | "Defaults to %(default)s.",
|
118 | 120 | )
|
119 | 121 | cli_arg_parser.add_argument(
|
| 122 | + "-f", |
120 | 123 | "--files-changed-only",
|
121 | 124 | default="false",
|
122 | 125 | type=lambda input: input.lower() == "true",
|
123 | 126 | help="Set this option to 'false' to analyse any source files in the repo. "
|
124 | 127 | "Defaults to %(default)s.",
|
125 | 128 | )
|
126 | 129 | cli_arg_parser.add_argument(
|
| 130 | + "-t", |
127 | 131 | "--thread-comments",
|
128 | 132 | default="false",
|
129 | 133 | type=lambda input: input.lower() == "true",
|
@@ -394,6 +398,11 @@ def run_clang_tidy(
|
394 | 398 | cmds = [f"clang-tidy-{version}"]
|
395 | 399 | if sys.platform.startswith("win32"):
|
396 | 400 | cmds = ["clang-tidy"]
|
| 401 | + if os.path.exists(version + os.sep + "bin"): |
| 402 | + cmds = [f"{version}\\bin\\clang-tidy.exe"] |
| 403 | + elif not version.isdigit(): |
| 404 | + logger.warning("ignoring invalid version number %s.", version) |
| 405 | + cmds = ["clang-tidy"] |
397 | 406 | if checks:
|
398 | 407 | cmds.append(f"-checks={checks}")
|
399 | 408 | cmds.append("--export-fixes=clang_tidy_output.yml")
|
@@ -440,11 +449,17 @@ def run_clang_format(
|
440 | 449 | lines_changed_only: A flag that forces focus on only changes in the event's
|
441 | 450 | diff info.
|
442 | 451 | """
|
| 452 | + is_on_windows = sys.platform.startswith("win32") |
443 | 453 | cmds = [
|
444 |
| - "clang-format" + ("" if sys.platform.startswith("win32") else f"-{version}"), |
| 454 | + "clang-format" + ("" if is_on_windows else f"-{version}"), |
445 | 455 | f"-style={style}",
|
446 | 456 | "--output-replacements-xml",
|
447 | 457 | ]
|
| 458 | + if is_on_windows and os.path.exists(version + os.sep + "bin"): |
| 459 | + cmds[0] = f"{version}\\bin\\clang-format.exe" |
| 460 | + elif not is_on_windows and not version.isdigit(): |
| 461 | + logger.warning("ignoring invalid version number %s.", version) |
| 462 | + cmds[0] = "clang-format" |
448 | 463 | if lines_changed_only:
|
449 | 464 | for line_range in file_obj["line_filter"]["lines"]:
|
450 | 465 | cmds.append(f"--lines={line_range[0]}:{line_range[1]}")
|
|
0 commit comments