fix: Fix remaining 61 ruff linting errors (SIM102, SIM117)

Fixed all remaining linting errors from the 310 total:
- SIM102: Combined nested if statements (31 errors)
  - adaptors/openai.py
  - config_extractor.py
  - codebase_scraper.py
  - doc_scraper.py
  - github_fetcher.py
  - pattern_recognizer.py
  - pdf_scraper.py
  - test_example_extractor.py

- SIM117: Combined multiple with statements (24 errors)
  - tests/test_async_scraping.py (2 errors)
  - tests/test_github_scraper.py (2 errors)
  - tests/test_guide_enhancer.py (20 errors)

- Fixed test fixture parameter (mock_config in test_c3_integration.py)

All 700+ tests passing.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
yusyus
2026-01-17 23:25:12 +03:00
parent 596b219599
commit 81dd5bbfbc
29 changed files with 720 additions and 360 deletions

View File

@@ -23,6 +23,7 @@ consider using dedicated parsers (tree-sitter, language-specific AST libraries).
"""
import ast
import contextlib
import logging
import re
from dataclasses import asdict, dataclass
@@ -142,7 +143,7 @@ class CodeAnalyzer:
if isinstance(node, ast.ClassDef):
class_sig = self._extract_python_class(node)
classes.append(asdict(class_sig))
elif isinstance(node, ast.FunctionDef) or isinstance(node, ast.AsyncFunctionDef):
elif isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
# Only top-level functions (not methods)
# Fix AST parser to check isinstance(parent.body, list) before 'in' operator
is_method = False
@@ -226,10 +227,8 @@ class CodeAnalyzer:
# Extract return type
return_type = None
if node.returns:
try:
with contextlib.suppress(Exception):
return_type = ast.unparse(node.returns) if hasattr(ast, "unparse") else None
except Exception:
pass
# Extract decorators
decorators = []