Skip to content

Commit f87ef79

Browse files
authored
revert changes in logic (#68)
1 parent 6981fa9 commit f87ef79

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

cpp_linter/run.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
GITHUB_EVENT_NAME = os.getenv("GITHUB_EVENT_NAME", "unknown")
4242
RUNNER_WORKSPACE = os.getenv("RUNNER_WORKSPACE", "")
4343

44+
IS_ON_WINDOWS = sys.platform.startswith("win32")
45+
4446
# setup CLI args
4547
cli_arg_parser = argparse.ArgumentParser(
4648
description=__doc__[: __doc__.find("If executed from")]
@@ -407,9 +409,11 @@ def run_clang_tidy(
407409
"clang-tidy" + ("" if not version else f"-{version}"),
408410
"--export-fixes=clang_tidy_output.yml",
409411
]
410-
if sys.platform.startswith("win32") and os.path.exists(version + os.sep + "bin"):
411-
cmds[0] = f"{version + os.sep}bin\\clang-tidy.exe"
412-
elif not sys.platform.startswith("win32") and not version.isdigit():
412+
if IS_ON_WINDOWS:
413+
cmds[0] = "clang-tidy"
414+
if os.path.exists(version + "\\bin"):
415+
cmds[0] = f"{version}\\bin\\clang-tidy.exe"
416+
elif not version.isdigit():
413417
logger.warning("ignoring invalid version number %s.", version)
414418
cmds[0] = "clang-tidy"
415419
if checks:
@@ -456,15 +460,16 @@ def run_clang_format(
456460
lines_changed_only: A flag that forces focus on only changes in the event's
457461
diff info.
458462
"""
459-
is_on_windows = sys.platform.startswith("win32")
460463
cmds = [
461464
"clang-format" + ("" if not version else f"-{version}"),
462465
f"-style={style}",
463466
"--output-replacements-xml",
464467
]
465-
if is_on_windows and os.path.exists(version + os.sep + "bin"):
466-
cmds[0] = f"{version}\\bin\\clang-format.exe"
467-
elif not is_on_windows and not version.isdigit():
468+
if IS_ON_WINDOWS:
469+
cmds[0] = "clang-format"
470+
if os.path.exists(version + "\\bin"):
471+
cmds[0] = f"{version}\\bin\\clang-format.exe"
472+
elif not version.isdigit():
468473
logger.warning("ignoring invalid version number %s.", version)
469474
cmds[0] = "clang-format"
470475
if lines_changed_only:

0 commit comments

Comments
 (0)