fix: resolve all ruff linting errors

Fixed 42 linting errors across codebase:
- Auto-fixed 35 import sorting issues (I001)
- Added unused imports to __all__ in execution/__init__.py
- Removed unused variable assignments (F841)
- Updated pyproject.toml to use [tool.ruff.lint] section

All ruff checks now pass successfully.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
mithun50 2025-11-12 18:17:39 +01:00
parent 8da05a1720
commit e2896335ba
22 changed files with 47 additions and 45 deletions

View File

@ -153,6 +153,8 @@ extend-exclude = '''
[tool.ruff]
line-length = 88
target-version = "py310"
[tool.ruff.lint]
select = ["E", "F", "I", "N", "W"]
ignore = ["E501"] # Line too long (handled by black)

View File

@ -10,8 +10,8 @@ __author__ = "NomenAK, Mithun Gowda B"
# Expose main components
from .pm_agent.confidence import ConfidenceChecker
from .pm_agent.self_check import SelfCheckProtocol
from .pm_agent.reflexion import ReflexionPattern
from .pm_agent.self_check import SelfCheckProtocol
__all__ = [
"ConfidenceChecker",

View File

@ -5,8 +5,7 @@ Health check for SuperClaude installation.
"""
from pathlib import Path
from typing import Dict, List, Any
import sys
from typing import Any, Dict
def run_doctor(verbose: bool = False) -> Dict[str, Any]:

View File

@ -4,9 +4,9 @@ Command Installation
Installs SuperClaude slash commands to ~/.claude/commands/sc/ directory.
"""
import shutil
from pathlib import Path
from typing import List, Tuple
import shutil
def install_commands(

View File

@ -4,9 +4,9 @@ Skill Installation Command
Installs SuperClaude skills to ~/.claude/skills/ directory.
"""
import shutil
from pathlib import Path
from typing import List, Optional, Tuple
import shutil
def install_skill_command(

View File

@ -4,9 +4,10 @@ SuperClaude CLI Main Entry Point
Provides command-line interface for SuperClaude operations.
"""
import click
from pathlib import Path
import sys
from pathlib import Path
import click
# Add parent directory to path to import superclaude
sys.path.insert(0, str(Path(__file__).parent.parent.parent))

View File

@ -17,10 +17,11 @@ Usage:
"""
from pathlib import Path
from typing import List, Dict, Any, Optional, Callable
from .reflection import ReflectionEngine, ConfidenceScore, reflect_before_execution
from .parallel import ParallelExecutor, Task, ExecutionPlan, should_parallelize
from .self_correction import SelfCorrectionEngine, RootCause, learn_from_failure
from typing import Any, Callable, Dict, List, Optional
from .parallel import ExecutionPlan, ParallelExecutor, Task, should_parallelize
from .reflection import ConfidenceScore, ReflectionEngine, reflect_before_execution
from .self_correction import RootCause, SelfCorrectionEngine, learn_from_failure
__all__ = [
"intelligent_execute",
@ -30,6 +31,10 @@ __all__ = [
"ConfidenceScore",
"ExecutionPlan",
"RootCause",
"Task",
"should_parallelize",
"reflect_before_execution",
"learn_from_failure",
]

View File

@ -11,11 +11,11 @@ Key features:
- Result aggregation and error handling
"""
from dataclasses import dataclass
from typing import List, Dict, Any, Callable, Optional, Set
from concurrent.futures import ThreadPoolExecutor, as_completed
from enum import Enum
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
from dataclasses import dataclass
from enum import Enum
from typing import Any, Callable, Dict, List, Optional, Set
class TaskStatus(Enum):
@ -106,9 +106,6 @@ class ParallelExecutor:
print(f"⚡ Parallel Executor: Planning {len(tasks)} tasks")
print("=" * 60)
# Build dependency graph
task_map = {task.id: task for task in tasks}
# Find parallel groups using topological sort
groups = []
completed = set()

View File

@ -9,11 +9,11 @@ Implements the "Triple Reflection" pattern:
Only proceeds with execution if confidence >70%.
"""
from dataclasses import dataclass
from pathlib import Path
from typing import List, Optional, Dict, Any
import json
from dataclasses import dataclass
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, List, Optional
@dataclass

View File

@ -12,12 +12,12 @@ Key features:
- Persistent learning memory
"""
from dataclasses import dataclass, asdict
from typing import List, Optional, Dict, Any
from pathlib import Path
import json
from datetime import datetime
import hashlib
import json
from dataclasses import asdict, dataclass
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, List, Optional
@dataclass
@ -288,7 +288,7 @@ class SelfCorrectionEngine:
Updates Reflexion memory with new learning.
"""
print(f"📚 Self-Correction: Learning from failure")
print("📚 Self-Correction: Learning from failure")
# Generate unique ID for this failure
failure_id = hashlib.md5(
@ -334,13 +334,13 @@ class SelfCorrectionEngine:
if "prevention_rules" not in data:
data["prevention_rules"] = []
data["prevention_rules"].append(root_cause.prevention_rule)
print(f"📝 Prevention rule added")
print("📝 Prevention rule added")
# Save updated memory
with open(self.reflexion_file, 'w') as f:
json.dump(data, f, indent=2)
print(f"💾 Reflexion memory updated")
print("💾 Reflexion memory updated")
def get_prevention_rules(self) -> List[str]:
"""Get all active prevention rules"""

View File

@ -9,8 +9,8 @@ Provides core functionality for PM Agent:
"""
from .confidence import ConfidenceChecker
from .self_check import SelfCheckProtocol
from .reflexion import ReflexionPattern
from .self_check import SelfCheckProtocol
__all__ = [
"ConfidenceChecker",

View File

@ -19,8 +19,8 @@ Required Checks:
5. Root cause identified with high certainty
"""
from typing import Dict, Any, Optional
from pathlib import Path
from typing import Any, Dict
class ConfidenceChecker:

View File

@ -23,10 +23,10 @@ Process:
4. Store for future reference (dual storage)
"""
from typing import Dict, List, Optional, Any
from pathlib import Path
import json
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, Optional
class ReflexionPattern:

View File

@ -13,7 +13,7 @@ The Four Questions:
4. Is there evidence?
"""
from typing import Dict, List, Tuple, Any, Optional
from typing import Any, Dict, List, Tuple
class SelfCheckProtocol:

View File

@ -9,13 +9,12 @@ Entry point registered in pyproject.toml:
superclaude = "superclaude.pytest_plugin"
"""
import pytest
from pathlib import Path
from typing import Dict, Any, Optional
from .pm_agent.confidence import ConfidenceChecker
from .pm_agent.self_check import SelfCheckProtocol
from .pm_agent.reflexion import ReflexionPattern
from .pm_agent.self_check import SelfCheckProtocol
from .pm_agent.token_budget import TokenBudgetManager

View File

@ -5,8 +5,8 @@ This file is automatically loaded by pytest and provides
shared fixtures available to all test modules.
"""
import pytest
from pathlib import Path
@pytest.fixture

View File

@ -91,13 +91,11 @@ class TestPytestPluginIntegration:
def test_pytest_markers_registered(self):
"""Test that custom markers are registered"""
# Get all registered markers
markers = {marker.name for marker in pytest.mark.__dict__.values() if hasattr(marker, "name")}
# Note: This test might need adjustment based on pytest version
# The important thing is that our custom markers exist
# confidence_check, self_check, reflexion, complexity
# These are registered in pytest_plugin.py
pass
class TestPytestPluginHooks:

View File

@ -4,8 +4,6 @@ Unit tests for CLI install command
Tests the command installation functionality.
"""
import pytest
from pathlib import Path
from superclaude.cli.install_commands import (
install_commands,
list_available_commands,
@ -172,7 +170,6 @@ def test_cli_integration():
This tests that the CLI main.py can successfully import the functions
"""
from superclaude.cli.install_commands import (
install_commands,
list_available_commands,
)

View File

@ -5,6 +5,7 @@ Tests pre-execution confidence assessment functionality.
"""
import pytest
from superclaude.pm_agent.confidence import ConfidenceChecker

View File

@ -5,6 +5,7 @@ Tests error learning and prevention functionality.
"""
import pytest
from superclaude.pm_agent.reflexion import ReflexionPattern
@ -165,7 +166,7 @@ def test_reflexion_with_real_exception():
try:
# Simulate an operation that fails
result = 10 / 0
_ = 10 / 0 # noqa: F841
except ZeroDivisionError as e:
# Record the error
error_info = {

View File

@ -5,6 +5,7 @@ Tests post-implementation validation functionality.
"""
import pytest
from superclaude.pm_agent.self_check import SelfCheckProtocol

View File

@ -5,6 +5,7 @@ Tests token budget allocation and management functionality.
"""
import pytest
from superclaude.pm_agent.token_budget import TokenBudgetManager