From 2cb13b5ebb18df88bdb575f89f5fcf1d72134d28 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 30 Aug 2024 14:35:02 -0700 Subject: [PATCH] refactor: update filter_important_files to use global IMPORTANT_FILES list --- aider/special.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/aider/special.py b/aider/special.py index 74f63c181..44d6c931a 100644 --- a/aider/special.py +++ b/aider/special.py @@ -62,6 +62,13 @@ IMPORTANT_FILES = [ "CODEOWNERS", ".pypirc", ] +def filter_important_files(file_paths): + """ + Filter a list of file paths to return only those that are commonly important in codebases. + + :param file_paths: List of file paths to check + :return: List of file paths that match important file patterns + """ def is_important(file_path): file_name = os.path.basename(file_path) dir_name = os.path.dirname(file_path) @@ -82,8 +89,8 @@ IMPORTANT_FILES = [ if file_name == "migrations" and os.path.isdir(file_path): return True - return file_name in important_files or any( - file_path.endswith(f"/{name}") for name in important_files + return file_name in IMPORTANT_FILES or any( + file_path.endswith(f"/{name}") for name in IMPORTANT_FILES ) return list(filter(is_important, file_paths))