From e9a6609b7d4aedffa9109bb26ce1bee31d92dbb6 Mon Sep 17 00:00:00 2001 From: Ryan Prichard Date: Fri, 20 Oct 2023 02:13:04 -0700 Subject: [PATCH 1/2] If INDUCE_FAILURE_IN_FORMATTER appears in file list, cause darker/clang-format failure --- llvm/utils/git/code-format-helper.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py index c45bb4d935d47..db2d4c5c52273 100644 --- a/llvm/utils/git/code-format-helper.py +++ b/llvm/utils/git/code-format-helper.py @@ -148,6 +148,11 @@ def format_run( args.end_rev, "--", ] + cpp_files + + # For manual testing purposes... + if "INDUCE_FAILURE_IN_FORMATTER" in " ".join(cpp_files): + cf_cmd.insert(1, "--induce-failure") + print(f"Running: {' '.join(cf_cmd)}") self.cf_cmd = cf_cmd proc = subprocess.run(cf_cmd, capture_output=True) @@ -192,6 +197,11 @@ def format_run( "-r", f"{args.start_rev}..{args.end_rev}", ] + py_files + + # For manual testing purposes... + if "INDUCE_FAILURE_IN_FORMATTER" in " ".join(py_files): + darker_cmd += ["--induce-failure"] + print(f"Running: {' '.join(darker_cmd)}") self.darker_cmd = darker_cmd proc = subprocess.run(darker_cmd, capture_output=True) From 88be1bb44e96c38f550da9385f89aa427d4360b5 Mon Sep 17 00:00:00 2001 From: Ryan Prichard Date: Fri, 20 Oct 2023 14:27:46 -0700 Subject: [PATCH 2/2] Both a C++ file and a Python file need formatting fixes --- llvm/utils/git/test1.cpp | 4 ++++ llvm/utils/git/test1.py | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 llvm/utils/git/test1.cpp create mode 100644 llvm/utils/git/test1.py diff --git a/llvm/utils/git/test1.cpp b/llvm/utils/git/test1.cpp new file mode 100644 index 0000000000000..fc2ab24e7d5f4 --- /dev/null +++ b/llvm/utils/git/test1.cpp @@ -0,0 +1,4 @@ +int main() +{ + return 1 +2; +} \ No newline at end of file diff --git a/llvm/utils/git/test1.py b/llvm/utils/git/test1.py new file mode 100644 index 0000000000000..0e81f925a140c --- /dev/null +++ b/llvm/utils/git/test1.py @@ -0,0 +1,4 @@ + +def main(): + return \ + 1 +2 \ No newline at end of file