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
This commit is contained in:
Fahad
2025-06-09 13:53:37 +04:00
parent a5da02c73f
commit e3e6f12cf3
5 changed files with 7 additions and 13 deletions

View File

@@ -18,10 +18,10 @@ from pathlib import Path
# Add parent directory to path to allow imports # Add parent directory to path to allow imports
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import json
from tools.analyze import AnalyzeTool from tools.analyze import AnalyzeTool
from tools.think_deeper import ThinkDeeperTool from tools.think_deeper import ThinkDeeperTool
from tools.debug_issue import DebugIssueTool
import json
async def run_manual_live_tests(): async def run_manual_live_tests():

View File

@@ -3,7 +3,7 @@ Tests for the review_pending_changes tool
""" """
import json import json
from unittest.mock import MagicMock, Mock, patch from unittest.mock import Mock, patch
import pytest import pytest

View File

@@ -2,10 +2,9 @@
Tool for reviewing pending git changes across multiple repositories. Tool for reviewing pending git changes across multiple repositories.
""" """
import json
import os import os
import re import re
from typing import Any, Dict, List, Literal, Optional from typing import Any, Dict, Literal, Optional
from pydantic import Field from pydantic import Field
@@ -168,7 +167,6 @@ class ReviewPendingChanges(BaseTool):
) )
if success and diff.strip(): if success and diff.strip():
# Format diff with file header # 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_header = f"\n--- BEGIN DIFF: {repo_name} / {file_path} (compare to {request.compare_to}) ---\n"
diff_footer = ( diff_footer = (
f"\n--- END DIFF: {repo_name} / {file_path} ---\n" f"\n--- END DIFF: {repo_name} / {file_path} ---\n"
@@ -200,7 +198,6 @@ class ReviewPendingChanges(BaseTool):
repo_path, ["diff", "--cached", "--", file_path] repo_path, ["diff", "--cached", "--", file_path]
) )
if success and diff.strip(): 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_header = f"\n--- BEGIN DIFF: {repo_name} / {file_path} (staged) ---\n"
diff_footer = ( diff_footer = (
f"\n--- END DIFF: {repo_name} / {file_path} ---\n" f"\n--- END DIFF: {repo_name} / {file_path} ---\n"
@@ -230,7 +227,6 @@ class ReviewPendingChanges(BaseTool):
repo_path, ["diff", "--", file_path] repo_path, ["diff", "--", file_path]
) )
if success and diff.strip(): 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_header = f"\n--- BEGIN DIFF: {repo_name} / {file_path} (unstaged) ---\n"
diff_footer = ( diff_footer = (
f"\n--- END DIFF: {repo_name} / {file_path} ---\n" f"\n--- END DIFF: {repo_name} / {file_path} ---\n"
@@ -274,7 +270,7 @@ class ReviewPendingChanges(BaseTool):
) )
# Add review parameters # 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"- Review Type: {request.review_type}")
prompt_parts.append(f"- Severity Filter: {request.severity_filter}") 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") prompt_parts.append(f"- Reviewing: {' and '.join(review_scope)} changes")
# Add repository summary # 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") prompt_parts.append(f"Found {len(repo_summaries)} repositories with changes:\n")
for idx, summary in enumerate(repo_summaries, 1): for idx, summary in enumerate(repo_summaries, 1):

View File

@@ -5,7 +5,6 @@ File reading utilities with directory support and token management
import os import os
from pathlib import Path from pathlib import Path
from typing import List, Optional, Tuple, Set from typing import List, Optional, Tuple, Set
import sys
from .token_utils import estimate_tokens, MAX_CONTEXT_TOKENS from .token_utils import estimate_tokens, MAX_CONTEXT_TOKENS

View File

@@ -2,9 +2,8 @@
Git utilities for finding repositories and generating diffs. Git utilities for finding repositories and generating diffs.
""" """
import os
import subprocess import subprocess
from typing import Dict, List, Optional, Tuple from typing import Dict, List, Tuple
from pathlib import Path from pathlib import Path