From 5fd94c3f033fd1c1804ee21e0d0a947d23991065 Mon Sep 17 00:00:00 2001 From: clavedeluna Date: Tue, 19 Mar 2024 11:51:41 -0300 Subject: [PATCH] do not log positive files to analyze if no codemods ran --- src/codemodder/codemodder.py | 4 +++- tests/test_codemodder.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/codemodder/codemodder.py b/src/codemodder/codemodder.py index 87363164..1061f33e 100644 --- a/src/codemodder/codemodder.py +++ b/src/codemodder/codemodder.py @@ -222,7 +222,9 @@ def run(original_args) -> int: ) codetf.write_report(argv.output) - log_report(context, argv, elapsed_ms, files_to_analyze) + log_report( + context, argv, elapsed_ms, [] if not codemods_to_run else files_to_analyze + ) return 0 diff --git a/tests/test_codemodder.py b/tests/test_codemodder.py index c6bd17e2..42473d2a 100644 --- a/tests/test_codemodder.py +++ b/tests/test_codemodder.py @@ -160,6 +160,8 @@ def test_codemod_include_no_match(self, write_report, info_logger, warning_logge write_report.assert_called_once() assert any("no codemods to run" in x[0][0] for x in info_logger.call_args_list) + assert any(x[0] == ("scanned: %s files", 0) for x in info_logger.call_args_list) + assert any( f"Requested codemod to include'{bad_codemod}' does not exist." in x[0][0] for x in warning_logger.call_args_list