From e3e6f12cf37b2bcf3c426916322c311b3ac50bc0 Mon Sep 17 00:00:00 2001 From: Fahad Date: Mon, 9 Jun 2025 13:53:37 +0400 Subject: [PATCH] fix: resolve linting issues across multiple files - Remove unused imports (os, Optional, json, List, sys, MagicMock, DebugIssueTool) - Remove unused variable assignments (safe_file_name) - Fix f-strings without placeholders - Reorder imports in test_live_integration.py --- tests/test_live_integration.py | 4 ++-- tests/test_review_pending_changes.py | 2 +- tools/review_pending_changes.py | 10 +++------- utils/file_utils.py | 1 - utils/git_utils.py | 3 +-- 5 files changed, 7 insertions(+), 13 deletions(-) diff --git a/tests/test_live_integration.py b/tests/test_live_integration.py index b0bb747..fc3ba9d 100644 --- a/tests/test_live_integration.py +++ b/tests/test_live_integration.py @@ -18,10 +18,10 @@ from pathlib import Path # Add parent directory to path to allow imports sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +import json + from tools.analyze import AnalyzeTool from tools.think_deeper import ThinkDeeperTool -from tools.debug_issue import DebugIssueTool -import json async def run_manual_live_tests(): diff --git a/tests/test_review_pending_changes.py b/tests/test_review_pending_changes.py index d60960a..49eb8f9 100644 --- a/tests/test_review_pending_changes.py +++ b/tests/test_review_pending_changes.py @@ -3,7 +3,7 @@ Tests for the review_pending_changes tool """ import json -from unittest.mock import MagicMock, Mock, patch +from unittest.mock import Mock, patch import pytest diff --git a/tools/review_pending_changes.py b/tools/review_pending_changes.py index f019b44..d8f2d22 100644 --- a/tools/review_pending_changes.py +++ b/tools/review_pending_changes.py @@ -2,10 +2,9 @@ Tool for reviewing pending git changes across multiple repositories. """ -import json import os import re -from typing import Any, Dict, List, Literal, Optional +from typing import Any, Dict, Literal, Optional from pydantic import Field @@ -168,7 +167,6 @@ class ReviewPendingChanges(BaseTool): ) if success and diff.strip(): # Format diff with file header - safe_file_name = self._sanitize_filename(file_path) diff_header = f"\n--- BEGIN DIFF: {repo_name} / {file_path} (compare to {request.compare_to}) ---\n" diff_footer = ( f"\n--- END DIFF: {repo_name} / {file_path} ---\n" @@ -200,7 +198,6 @@ class ReviewPendingChanges(BaseTool): repo_path, ["diff", "--cached", "--", file_path] ) if success and diff.strip(): - safe_file_name = self._sanitize_filename(file_path) diff_header = f"\n--- BEGIN DIFF: {repo_name} / {file_path} (staged) ---\n" diff_footer = ( f"\n--- END DIFF: {repo_name} / {file_path} ---\n" @@ -230,7 +227,6 @@ class ReviewPendingChanges(BaseTool): repo_path, ["diff", "--", file_path] ) if success and diff.strip(): - safe_file_name = self._sanitize_filename(file_path) diff_header = f"\n--- BEGIN DIFF: {repo_name} / {file_path} (unstaged) ---\n" diff_footer = ( f"\n--- END DIFF: {repo_name} / {file_path} ---\n" @@ -274,7 +270,7 @@ class ReviewPendingChanges(BaseTool): ) # Add review parameters - prompt_parts.append(f"## Review Parameters\n") + prompt_parts.append("## Review Parameters\n") prompt_parts.append(f"- Review Type: {request.review_type}") prompt_parts.append(f"- Severity Filter: {request.severity_filter}") @@ -292,7 +288,7 @@ class ReviewPendingChanges(BaseTool): prompt_parts.append(f"- Reviewing: {' and '.join(review_scope)} changes") # Add repository summary - prompt_parts.append(f"\n## Repository Changes Summary\n") + prompt_parts.append("\n## Repository Changes Summary\n") prompt_parts.append(f"Found {len(repo_summaries)} repositories with changes:\n") for idx, summary in enumerate(repo_summaries, 1): diff --git a/utils/file_utils.py b/utils/file_utils.py index 1ccffc6..749bba3 100644 --- a/utils/file_utils.py +++ b/utils/file_utils.py @@ -5,7 +5,6 @@ File reading utilities with directory support and token management import os from pathlib import Path from typing import List, Optional, Tuple, Set -import sys from .token_utils import estimate_tokens, MAX_CONTEXT_TOKENS diff --git a/utils/git_utils.py b/utils/git_utils.py index c988b15..f54aed6 100644 --- a/utils/git_utils.py +++ b/utils/git_utils.py @@ -2,9 +2,8 @@ Git utilities for finding repositories and generating diffs. """ -import os import subprocess -from typing import Dict, List, Optional, Tuple +from typing import Dict, List, Tuple from pathlib import Path