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

@@ -5,12 +5,11 @@ and provide consistent behavior for configuration, output control, and help.
"""
import argparse
from typing import Dict, Any
from typing import Any
# Common argument definitions as data structure
# These are arguments that appear in MULTIPLE commands
COMMON_ARGUMENTS: Dict[str, Dict[str, Any]] = {
COMMON_ARGUMENTS: dict[str, dict[str, Any]] = {
"config": {
"flags": ("--config", "-c"),
"kwargs": {
@@ -67,10 +66,9 @@ COMMON_ARGUMENTS: Dict[str, Dict[str, Any]] = {
},
}
# RAG (Retrieval-Augmented Generation) arguments
# These are shared across commands that support RAG chunking
RAG_ARGUMENTS: Dict[str, Dict[str, Any]] = {
RAG_ARGUMENTS: dict[str, dict[str, Any]] = {
"chunk_for_rag": {
"flags": ("--chunk-for-rag",),
"kwargs": {
@@ -98,15 +96,14 @@ RAG_ARGUMENTS: Dict[str, Dict[str, Any]] = {
},
}
def add_common_arguments(parser: argparse.ArgumentParser) -> None:
"""Add common arguments to a parser.
These arguments are shared across most commands for consistent UX.
Args:
parser: The ArgumentParser to add arguments to
Example:
>>> parser = argparse.ArgumentParser()
>>> add_common_arguments(parser)
@@ -117,7 +114,6 @@ def add_common_arguments(parser: argparse.ArgumentParser) -> None:
kwargs = arg_def["kwargs"]
parser.add_argument(*flags, **kwargs)
def get_common_argument_names() -> set:
"""Get the set of common argument destination names.
@@ -126,7 +122,6 @@ def get_common_argument_names() -> set:
"""
return set(COMMON_ARGUMENTS.keys())
def add_rag_arguments(parser: argparse.ArgumentParser) -> None:
"""Add RAG (Retrieval-Augmented Generation) arguments to a parser.
@@ -145,7 +140,6 @@ def add_rag_arguments(parser: argparse.ArgumentParser) -> None:
kwargs = arg_def["kwargs"]
parser.add_argument(*flags, **kwargs)
def get_rag_argument_names() -> set:
"""Get the set of RAG argument destination names.
@@ -154,16 +148,15 @@ def get_rag_argument_names() -> set:
"""
return set(RAG_ARGUMENTS.keys())
def get_argument_help(arg_name: str) -> str:
"""Get the help text for a common argument.
Args:
arg_name: Name of the argument (e.g., 'config')
Returns:
Help text string
Raises:
KeyError: If argument doesn't exist
"""