From 54476b5584510d18a42119cd9387b3f1e95a0e13 Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Tue, 15 Apr 2025 23:42:29 +0200 Subject: [PATCH 1/3] Initial ruff pass --- aider_gitea/__init__.py | 6 ++++-- test/test_solve_issue_in_repository.py | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/aider_gitea/__init__.py b/aider_gitea/__init__.py index c7c6852..2ba421e 100644 --- a/aider_gitea/__init__.py +++ b/aider_gitea/__init__.py @@ -283,8 +283,10 @@ def run_cmd(cmd: list[str], cwd: Path | None = None, check=True) -> bool: result = subprocess.run(cmd, check=check, cwd=cwd) return result.returncode == 0 + SKIP_AIDER = False + def solve_issue_in_repository( args, tmpdirname: Path, @@ -294,7 +296,7 @@ def solve_issue_in_repository( issue_number: str, gitea_client=None, ) -> bool: - logger.info("### %s #####", issue_title) + logger.info('### %s #####', issue_title) repo_url = f'{args.gitea_url}:{args.owner}/{args.repo}.git'.replace( 'https://', @@ -331,7 +333,7 @@ def solve_issue_in_repository( check=False, ) else: - logger.warning("Skipping aider command (for testing)") + logger.warning('Skipping aider command (for testing)') succeeded = True if not succeeded: logger.error('Aider invocation failed for issue #%s', issue_number) diff --git a/test/test_solve_issue_in_repository.py b/test/test_solve_issue_in_repository.py index 0377094..76d1ab2 100644 --- a/test/test_solve_issue_in_repository.py +++ b/test/test_solve_issue_in_repository.py @@ -24,7 +24,11 @@ class TestSolveIssueInRepository: @patch('aider_gitea.push_changes') @patch('subprocess.run') def test_solve_issue_with_aider_changes( - self, mock_subprocess_run, mock_push_changes, mock_run_cmd, mock_llm_api_key, + self, + mock_subprocess_run, + mock_push_changes, + mock_run_cmd, + mock_llm_api_key, ): # Setup mocks mock_run_cmd.return_value = True @@ -34,7 +38,8 @@ class TestSolveIssueInRepository: mock_subprocess_run.side_effect = [ MagicMock(stdout='abc123\n', returncode=0), # First git rev-parse MagicMock( - stdout='file1.py\nfile2.py\n', returncode=0, + stdout='file1.py\nfile2.py\n', + returncode=0, ), # git diff with changes ] @@ -59,7 +64,11 @@ class TestSolveIssueInRepository: @patch('aider_gitea.push_changes') @patch('subprocess.run') def test_solve_issue_without_aider_changes( - self, mock_subprocess_run, mock_push_changes, mock_run_cmd, mock_llm_api_key, + self, + mock_subprocess_run, + mock_push_changes, + mock_run_cmd, + mock_llm_api_key, ): # Setup mocks mock_run_cmd.return_value = True -- 2.45.1 From d898d91bfa6a6dfb1dc6edc46829931bcccca4f9 Mon Sep 17 00:00:00 2001 From: "Jon Michael Aanes (aider)" Date: Tue, 15 Apr 2025 23:42:52 +0200 Subject: [PATCH 2/3] feat: add cost documentation to pull request description --- aider_gitea/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aider_gitea/__init__.py b/aider_gitea/__init__.py index 2ba421e..a48892a 100644 --- a/aider_gitea/__init__.py +++ b/aider_gitea/__init__.py @@ -226,6 +226,9 @@ def push_changes( description += '## Commit Messages\n\n' for message in commit_messages: description += f'- {message}\n' + + # Add trailing line documenting costs + description += '\n## Costs\nThis task was solved using AI assistance.' # First push the branch without creating a PR cmd = ['git', 'push', 'origin', branch_name, '--force'] -- 2.45.1 From e3a39f98b8d1d2d406b48d86524b4fa119ccb26b Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Tue, 15 Apr 2025 23:42:56 +0200 Subject: [PATCH 3/3] Ruff after aider --- aider_gitea/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aider_gitea/__init__.py b/aider_gitea/__init__.py index a48892a..20459ce 100644 --- a/aider_gitea/__init__.py +++ b/aider_gitea/__init__.py @@ -226,7 +226,7 @@ def push_changes( description += '## Commit Messages\n\n' for message in commit_messages: description += f'- {message}\n' - + # Add trailing line documenting costs description += '\n## Costs\nThis task was solved using AI assistance.' -- 2.45.1