From 93a5e1a46b43a5bc031e4f8daeb25fb05b5edff8 Mon Sep 17 00:00:00 2001
From: Campbell Barton <ideasman42@gmail.com>
Date: Thu, 28 Apr 2022 15:44:48 +1000
Subject: [PATCH] Don't report files as being operated on which are later
 filtered out

This is confusing when passing one set of files to both clang-format
and autopep8.
---
 utils_maintenance/autopep8_format_paths.py | 7 +++++++
 utils_maintenance/clang_format_paths.py    | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/utils_maintenance/autopep8_format_paths.py b/utils_maintenance/autopep8_format_paths.py
index e6f3cd7..1eead25 100644
--- a/utils_maintenance/autopep8_format_paths.py
+++ b/utils_maintenance/autopep8_format_paths.py
@@ -32,6 +32,13 @@ def compute_paths(paths, use_default_paths):
             "source",
             "tests",
         )
+    else:
+        # Filter out files, this is only done so this utility wont print that it's
+        # "Operating" on files that will be filtered out later on.
+        paths = [
+            f for f in paths
+            if os.path.isfile(f) and f.endswith(extensions)
+        ]
 
     if os.sep != "/":
         paths = [f.replace("/", os.sep) for f in paths]
diff --git a/utils_maintenance/clang_format_paths.py b/utils_maintenance/clang_format_paths.py
index c0671d4..e81d487 100755
--- a/utils_maintenance/clang_format_paths.py
+++ b/utils_maintenance/clang_format_paths.py
@@ -59,6 +59,13 @@ def compute_paths(paths, use_default_paths):
             "source",
             "tests/gtests",
         )
+    else:
+        # Filter out files, this is only done so this utility wont print that it's
+        # "Operating" on files that will be filtered out later on.
+        paths = [
+            f for f in paths
+            if os.path.isfile(f) and f.endswith(extensions)
+        ]
 
     if os.sep != "/":
         paths = [f.replace("/", os.sep) for f in paths]
-- 
GitLab