fix: resolve all CI ruff linting errors (F401, F821, ARG001, SIM117, SIM105, C408)

- Remove unused imports (F401): os/Path/json/threading in tests; os in estimate_pages;
  Path in install_skill; pytest in test_unified_scraper_orchestration
- Fix F821 undefined 'args' in unified_scraper._scrape_local() by storing
  self._cli_args = args in run() and reading via getattr in _scrape_local()
- Fix ARG001/ARG005 unused lambda/function arguments with _ prefix or # noqa:ARG001
  where parameter names must be preserved for keyword-argument compatibility
- Fix C408 unnecessary dict() calls → dict literals in test_enhance_command
- Fix F841 unused variable 'stub' in test_enhance_command
- Fix SIM117 nested with statements → single with in test_unified_scraper_orchestration
- Fix SIM105 try/except/pass → contextlib.suppress in test_unified_scraper_orchestration
- Rewrite TestScrapeLocal to test fixed behavior (not the NameError bug)

All 2267 tests pass, 11 skipped.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
yusyus
2026-02-22 22:30:52 +03:00
parent f7117c35a9
commit efc722eeed
8 changed files with 89 additions and 94 deletions

View File

@@ -2,7 +2,6 @@
import argparse
import sys
import types
import pytest
@@ -13,19 +12,19 @@ import pytest
def _make_args(**kwargs):
"""Build a fake Namespace with sensible defaults."""
defaults = dict(
skill_directory="output/react",
target=None,
api_key=None,
dry_run=False,
agent=None,
agent_cmd=None,
interactive_enhancement=False,
background=False,
daemon=False,
no_force=False,
timeout=600,
)
defaults = {
"skill_directory": "output/react",
"target": None,
"api_key": None,
"dry_run": False,
"agent": None,
"agent_cmd": None,
"interactive_enhancement": False,
"background": False,
"daemon": False,
"no_force": False,
"timeout": 600,
}
defaults.update(kwargs)
return argparse.Namespace(**defaults)
@@ -169,8 +168,6 @@ class TestPickModeAutoDetect:
class TestPickModeConfigAgent:
def _patch_config(self, monkeypatch, agent: str | None):
"""Patch get_config_manager to return a stub with get_default_agent()."""
stub = types.SimpleNamespace(get_default_agent=lambda: agent)
monkeypatch.setattr(
"skill_seekers.cli.enhance_command._get_config_default_agent",
lambda: agent,
@@ -312,7 +309,7 @@ class TestEnhanceCommandMain:
# Patch _run_api_mode to avoid real API call
monkeypatch.setattr(
"skill_seekers.cli.enhance_command._run_api_mode",
lambda args, target: 0,
lambda *_: 0,
)
sys_argv_backup = sys.argv.copy()