fix: Resolve all linting errors from ruff

Fix 145 linting errors across CLI refactor code:

Type annotation modernization (Python 3.9+):
- Replace typing.Dict with dict
- Replace typing.List with list
- Replace typing.Set with set
- Replace Optional[X] with X | None

Code quality improvements:
- Remove trailing whitespace (W291)
- Remove whitespace from blank lines (W293)
- Remove unused imports (F401)
- Use dictionary lookup instead of if-elif chains (SIM116)
- Combine nested if statements (SIM102)

Files fixed (45 files):
- src/skill_seekers/cli/arguments/*.py (10 files)
- src/skill_seekers/cli/parsers/*.py (24 files)
- src/skill_seekers/cli/presets/*.py (4 files)
- src/skill_seekers/cli/create_command.py
- src/skill_seekers/cli/source_detector.py
- src/skill_seekers/cli/github_scraper.py
- tests/test_*.py (5 test files)

All files now pass ruff linting checks.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
yusyus
2026-02-15 20:20:55 +03:00
parent 4c6d885725
commit 83b03d9f9f
45 changed files with 134 additions and 270 deletions

View File

@@ -9,14 +9,13 @@ Presets:
"""
from dataclasses import dataclass, field
from typing import Dict
import argparse
import argparse
@dataclass(frozen=True)
class GitHubPreset:
"""Definition of a GitHub preset.
Attributes:
name: Human-readable preset name
description: Brief description of what this preset does
@@ -27,10 +26,9 @@ class GitHubPreset:
name: str
description: str
max_issues: int
features: Dict[str, bool] = field(default_factory=dict)
features: dict[str, bool] = field(default_factory=dict)
estimated_time: str = ""
# Preset definitions
GITHUB_PRESETS = {
"quick": GitHubPreset(
@@ -44,7 +42,7 @@ GITHUB_PRESETS = {
},
estimated_time="1-3 minutes"
),
"standard": GitHubPreset(
name="Standard",
description="Balanced scraping with issues and releases (recommended)",
@@ -56,7 +54,7 @@ GITHUB_PRESETS = {
},
estimated_time="5-15 minutes"
),
"comprehensive": GitHubPreset(
name="Comprehensive",
description="Comprehensive scraping with all available data",
@@ -70,48 +68,46 @@ GITHUB_PRESETS = {
),
}
def apply_github_preset(args: argparse.Namespace, preset_name: str) -> None:
"""Apply a GitHub preset to the args namespace.
Args:
args: The argparse.Namespace to modify
preset_name: Name of the preset to apply
Raises:
KeyError: If preset_name is not a valid preset
"""
preset = GITHUB_PRESETS[preset_name]
# Apply max_issues only if not set by user
if args.max_issues is None or args.max_issues == 100: # 100 is default
args.max_issues = preset.max_issues
# Apply feature flags (only if not explicitly disabled by user)
for feature, enabled in preset.features.items():
skip_attr = f"no_{feature}"
if not hasattr(args, skip_attr) or not getattr(args, skip_attr):
setattr(args, skip_attr, not enabled)
def show_github_preset_list() -> None:
"""Print the list of available GitHub presets to stdout."""
print("\nAvailable GitHub Presets")
print("=" * 60)
print()
for name, preset in GITHUB_PRESETS.items():
marker = " (DEFAULT)" if name == "standard" else ""
print(f" {name}{marker}")
print(f" {preset.description}")
print(f" Estimated time: {preset.estimated_time}")
print(f" Max issues: {preset.max_issues}")
# Show enabled features
enabled = [f.replace("include_", "") for f, v in preset.features.items() if v]
if enabled:
print(f" Features: {', '.join(enabled)}")
print()
print("Usage: skill-seekers github --repo <owner/repo> --preset <name>")
print()