refactor: replace f-strings with logging string formatting

This commit is contained in:
Jon Michael Aanes (aider) 2025-04-14 23:50:44 +02:00
parent 0c4fae510c
commit de7124f65b
2 changed files with 5 additions and 4 deletions

View File

@ -221,7 +221,7 @@ def has_commits_on_branch(cwd: Path, base_branch: str, current_branch: str) -> b
) )
return bool(result.stdout.strip()) return bool(result.stdout.strip())
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
logger.exception(f'Failed to check commits on branch {current_branch}') logger.exception('Failed to check commits on branch %s', current_branch)
return False return False
@ -260,8 +260,9 @@ def solve_issue_in_repository(
run_cmd(['git', 'checkout', '-b', branch_name], tmpdirname) run_cmd(['git', 'checkout', '-b', branch_name], tmpdirname)
# Run aider # Run aider
issue_content = f'# {issue_title}\n{issue_description}'
succeeded = run_cmd( succeeded = run_cmd(
create_aider_command(f'# {issue_title}\n{issue_description}'), create_aider_command(issue_content),
tmpdirname, tmpdirname,
check=False, check=False,
) )
@ -308,7 +309,7 @@ def handle_issues(args, client, seen_issues_db):
title = issue.get('title', f'Issue {issue_number}') title = issue.get('title', f'Issue {issue_number}')
issue_text = f'{title}\n{issue_description}' issue_text = f'{title}\n{issue_description}'
if seen_issues_db.has_seen(issue_text): if seen_issues_db.has_seen(issue_text):
logger.info(f'Skipping already processed issue #{issue_number}: {title}') logger.info('Skipping already processed issue #%s: %s', issue_number, title)
continue continue
branch_name = generate_branch_name(issue_number, title) branch_name = generate_branch_name(issue_number, title)

View File

@ -73,7 +73,7 @@ class GiteaClient:
json_data = {'ref': f'refs/heads/{new_branch}', 'sha': sha} json_data = {'ref': f'refs/heads/{new_branch}', 'sha': sha}
response = self.session.post(url, json=json_data) response = self.session.post(url, json=json_data)
if response.status_code == 422: if response.status_code == 422:
logger.warning(f'Branch {new_branch} already exists.') logger.warning('Branch %s already exists.', new_branch)
return False return False
response.raise_for_status() response.raise_for_status()
return True return True