99 create_branch ,
1010 get_message ,
1111 get_target_edit_files ,
12+ get_lint_cmd ,
1213)
1314from baselines .agents import AiderAgents
1415from typing import Optional , Type
@@ -63,8 +64,6 @@ def run_agent_for_repo(
6364 f"{ repo_path } is not a git repo. Check if base_dir is correctly specified."
6465 )
6566
66- target_edit_files = get_target_edit_files (repo_path )
67-
6867 if agent_config .agent_name == "aider" :
6968 agent = AiderAgents (agent_config .max_iteration , agent_config .model_name )
7069 else :
@@ -81,24 +80,20 @@ def run_agent_for_repo(
8180 # TODO: ask user for permission
8281 if latest_commit .hexsha != example ["base_commit" ]:
8382 local_repo .git .reset ("--hard" , example ["base_commit" ])
83+ target_edit_files = get_target_edit_files (repo_path )
8484
8585 with DirContext (repo_path ):
8686 if commit0_config is None or agent_config is None :
8787 raise ValueError ("Invalid input" )
8888
8989 message = get_message (agent_config , repo_path , example ["test" ]["test_dir" ])
90-
91- if agent_config .use_lint_info :
92- lint_cmd = "pre-commit run --config ../../.pre-commit-config.yaml --files"
93- else :
94- lint_cmd = ""
95-
9690 if agent_config .run_tests :
9791 # when unit test feedback is available, iterate over test files
9892 for test_file in test_files :
9993 test_cmd = f"python -m commit0 test { repo_path } { run_id } { test_file } "
10094 test_file_name = test_file .replace (".py" , "" ).replace ("/" , "__" )
10195 log_dir = RUN_AIDER_LOG_DIR / "with_tests" / test_file_name
96+ lint_cmd = get_lint_cmd (local_repo , agent_config .use_lint_info )
10297
10398 agent .run (
10499 message ,
@@ -112,6 +107,7 @@ def run_agent_for_repo(
112107 for f in target_edit_files :
113108 file_name = f .replace (".py" , "" ).replace ("/" , "__" )
114109 log_dir = RUN_AIDER_LOG_DIR / "no_tests" / file_name
110+ lint_cmd = get_lint_cmd (local_repo , agent_config .use_lint_info )
115111
116112 agent .run (message , "" , lint_cmd , [f ], log_dir )
117113
0 commit comments