From 79b75dc165f13332d984c8bcb0416565327c78d4 Mon Sep 17 00:00:00 2001 From: "Jon Michael Aanes (aider)" Date: Sun, 20 Apr 2025 01:14:52 +0200 Subject: [PATCH] feat: add code quality pass to fix lint issues with aider before pushing --- aider_gitea/__init__.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/aider_gitea/__init__.py b/aider_gitea/__init__.py index 1c35b2b..5560490 100644 --- a/aider_gitea/__init__.py +++ b/aider_gitea/__init__.py @@ -380,6 +380,21 @@ def solve_issue_in_repository( ) return IssueResolution(False) + # Code quality pass: ensure ruff passes + result = subprocess.run( + ['bash', '-c', 'ruff check .'], + check=False, + cwd=tmpdirname, + capture_output=True, + text=True, + ) + if result.returncode != 0: + logger.info('Code quality issues detected, invoking aider to fix lint...') + run_cmd(create_aider_command(issue_content), tmpdirname, check=False) + run_cmd(['bash', '-c', RUFF_FORMAT_AND_AUTO_FIX], tmpdirname, check=False) + run_cmd(['git', 'add', '.'], tmpdirname) + run_cmd(['git', 'commit', '-m', 'Aider lint fixes'], tmpdirname, check=False) + # Push changes return push_changes( repository_config,