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

@@ -5,7 +5,6 @@ Quickly estimates how many pages a config will scrape without downloading conten
"""
import json
import os
import sys
import time
from pathlib import Path

View File

@@ -29,7 +29,6 @@ Examples:
import argparse
import asyncio
import sys
from pathlib import Path
# Import the MCP tool function (with lazy loading)
try:

View File

@@ -562,7 +562,8 @@ class UnifiedScraper:
# Note: Signal flow analysis is automatic for Godot projects (C3.10)
# AI enhancement settings (CLI --enhance-level overrides per-source config)
cli_enhance_level = getattr(args, "enhance_level", None) if args is not None else None
cli_args = getattr(self, "_cli_args", None)
cli_enhance_level = getattr(cli_args, "enhance_level", None) if cli_args is not None else None
enhance_level = cli_enhance_level if cli_enhance_level is not None else source.get("enhance_level", 0)
# Run codebase analysis
@@ -953,6 +954,9 @@ class UnifiedScraper:
When provided, enhancement workflows (--enhance-workflow,
--enhance-stage) are executed after the skill is built.
"""
# Store CLI args so _scrape_local() can access --enhance-level override
self._cli_args = args
logger.info("\n" + "🚀 " * 20)
logger.info(f"Unified Scraper: {self.config['name']}")
logger.info("🚀 " * 20 + "\n")