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

@@ -1,7 +1,3 @@
import json
import os
import threading
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
@@ -485,7 +481,7 @@ class TestRunHeadless:
mock_result.stdout = ""
mock_result.stderr = ""
def _fake_run(prompt_file, timeout, include_permissions_flag, quiet=False):
def _fake_run(prompt_file, timeout, include_permissions_flag, quiet=False): # noqa: ARG001
# Simulate agent updating SKILL.md with more content
import time
time.sleep(0.01)
@@ -582,7 +578,7 @@ class TestRunBackground:
# Delay the headless run to confirm we don't block
import time
def _slow_run(*args, **kwargs):
def _slow_run(*_args, **_kwargs):
time.sleep(0.5)
return True