diff --git a/src/skill_seekers/cli/adaptors/__init__.py b/src/skill_seekers/cli/adaptors/__init__.py index ccd59a5..f5e77e5 100644 --- a/src/skill_seekers/cli/adaptors/__init__.py +++ b/src/skill_seekers/cli/adaptors/__init__.py @@ -6,8 +6,6 @@ Provides factory function to get platform-specific adaptors for skill generation Supports Claude AI, Google Gemini, OpenAI ChatGPT, and generic Markdown export. """ -from typing import Dict, Type - from .base import SkillAdaptor, SkillMetadata # Import adaptors (some may not be implemented yet) diff --git a/src/skill_seekers/cli/adaptors/claude.py b/src/skill_seekers/cli/adaptors/claude.py index 95f7302..6ed22c3 100644 --- a/src/skill_seekers/cli/adaptors/claude.py +++ b/src/skill_seekers/cli/adaptors/claude.py @@ -174,7 +174,7 @@ version: {metadata.version} "message": f"File not found: {package_path}", } - if not package_path.suffix == ".zip": + if package_path.suffix != ".zip": return { "success": False, "skill_id": None, @@ -208,7 +208,7 @@ version: {metadata.version} try: response_data = response.json() skill_id = response_data.get("id") - except: + except Exception: skill_id = None return { @@ -229,7 +229,7 @@ version: {metadata.version} elif response.status_code == 400: try: error_msg = response.json().get("error", {}).get("message", "Unknown error") - except: + except Exception: error_msg = "Invalid skill format" return { @@ -242,7 +242,7 @@ version: {metadata.version} else: try: error_msg = response.json().get("error", {}).get("message", "Unknown error") - except: + except Exception: error_msg = f"HTTP {response.status_code}" return { diff --git a/src/skill_seekers/cli/adaptors/gemini.py b/src/skill_seekers/cli/adaptors/gemini.py index d1fbfb3..e07be69 100644 --- a/src/skill_seekers/cli/adaptors/gemini.py +++ b/src/skill_seekers/cli/adaptors/gemini.py @@ -176,7 +176,7 @@ See the references directory for complete documentation with examples and best p "message": f"File not found: {package_path}", } - if not package_path.suffix == ".gz": + if package_path.suffix != ".gz": return { "success": False, "skill_id": None, diff --git a/src/skill_seekers/cli/adaptors/openai.py b/src/skill_seekers/cli/adaptors/openai.py index 612d69c..8b3829b 100644 --- a/src/skill_seekers/cli/adaptors/openai.py +++ b/src/skill_seekers/cli/adaptors/openai.py @@ -192,7 +192,7 @@ Always prioritize accuracy by consulting the attached documentation files before "message": f"File not found: {package_path}", } - if not package_path.suffix == ".zip": + if package_path.suffix != ".zip": return { "success": False, "skill_id": None, diff --git a/src/skill_seekers/cli/code_analyzer.py b/src/skill_seekers/cli/code_analyzer.py index 0bb514d..4df21e7 100644 --- a/src/skill_seekers/cli/code_analyzer.py +++ b/src/skill_seekers/cli/code_analyzer.py @@ -220,7 +220,7 @@ class CodeAnalyzer: params[param_idx].default = ( ast.unparse(default) if hasattr(ast, "unparse") else str(default) ) - except: + except Exception: params[param_idx].default = "..." # Extract return type @@ -228,7 +228,7 @@ class CodeAnalyzer: if node.returns: try: return_type = ast.unparse(node.returns) if hasattr(ast, "unparse") else None - except: + except Exception: pass # Extract decorators @@ -239,7 +239,7 @@ class CodeAnalyzer: decorators.append(ast.unparse(decorator)) elif isinstance(decorator, ast.Name): decorators.append(decorator.id) - except: + except Exception: pass # Extract docstring diff --git a/src/skill_seekers/cli/codebase_scraper.py b/src/skill_seekers/cli/codebase_scraper.py index 2a4d61d..7afaad5 100644 --- a/src/skill_seekers/cli/codebase_scraper.py +++ b/src/skill_seekers/cli/codebase_scraper.py @@ -398,7 +398,7 @@ def analyze_codebase( try: dot_file = dep_output_dir / "dependency_graph.dot" dep_analyzer.export_dot(str(dot_file)) - except: + except Exception: pass # pydot not installed, skip DOT export # Detect design patterns if requested (C3.1) diff --git a/src/skill_seekers/cli/config_command.py b/src/skill_seekers/cli/config_command.py index 0b8d4d5..aaaae88 100644 --- a/src/skill_seekers/cli/config_command.py +++ b/src/skill_seekers/cli/config_command.py @@ -364,7 +364,7 @@ def set_api_key(provider: str, url: str): try: webbrowser.open(url) print("✅ Opened in browser\n") - except: + except Exception: pass key = input(f"Enter {provider.capitalize()} API key (or leave empty to skip): ").strip() diff --git a/src/skill_seekers/cli/config_enhancer.py b/src/skill_seekers/cli/config_enhancer.py index b9a5517..38b7bf4 100644 --- a/src/skill_seekers/cli/config_enhancer.py +++ b/src/skill_seekers/cli/config_enhancer.py @@ -267,9 +267,9 @@ Focus on actionable insights that help developers understand and improve their c if result_data: # Merge LOCAL enhancements - original_result["ai_enhancements"] = result_data + result["ai_enhancements"] = result_data logger.info("✅ LOCAL enhancement complete") - return original_result + return result else: logger.warning("⚠️ LOCAL enhancement produced no results") return result @@ -370,7 +370,7 @@ Focus on actionable insights: if "file_enhancements" in data or "overall_insights" in data: logger.info(f"✅ Found enhancement data in {json_file.name}") return data - except: + except Exception: continue logger.warning("⚠️ Could not find enhancement output file") diff --git a/src/skill_seekers/cli/config_extractor.py b/src/skill_seekers/cli/config_extractor.py index 3e472ab..896269d 100644 --- a/src/skill_seekers/cli/config_extractor.py +++ b/src/skill_seekers/cli/config_extractor.py @@ -29,15 +29,16 @@ except ImportError: logger.debug("PyYAML not available - YAML parsing will be limited") try: - import tomli + import tomli as toml_lib TOML_AVAILABLE = True except ImportError: try: - import toml + import toml as toml_lib # noqa: F401 TOML_AVAILABLE = True except ImportError: + toml_lib = None TOML_AVAILABLE = False logger.debug("toml/tomli not available - TOML parsing disabled") @@ -408,13 +409,7 @@ class ConfigParser: return try: - if "tomli" in globals(): - data = tomli.loads(config_file.raw_content) - else: - import toml - - data = toml.loads(config_file.raw_content) - + data = toml_lib.loads(config_file.raw_content) self._extract_settings_from_dict(data, config_file) except Exception as e: config_file.parse_errors.append(f"TOML parse error: {str(e)}") diff --git a/src/skill_seekers/cli/doc_scraper.py b/src/skill_seekers/cli/doc_scraper.py index 4440108..ffaa665 100755 --- a/src/skill_seekers/cli/doc_scraper.py +++ b/src/skill_seekers/cli/doc_scraper.py @@ -1260,7 +1260,7 @@ class DocToSkillConverter: if not category_defs: category_defs = self.infer_categories(pages) - categories: dict[str, list[dict[str, Any]]] = {cat: [] for cat in category_defs.keys()} + categories: dict[str, list[dict[str, Any]]] = {cat: [] for cat in category_defs} categories["other"] = [] for page in pages: diff --git a/src/skill_seekers/cli/enhance_skill_local.py b/src/skill_seekers/cli/enhance_skill_local.py index 972b792..e39c7bd 100644 --- a/src/skill_seekers/cli/enhance_skill_local.py +++ b/src/skill_seekers/cli/enhance_skill_local.py @@ -455,7 +455,7 @@ After writing, the file SKILL.md should: try: return json.loads(self.status_file.read_text(encoding="utf-8")) - except: + except Exception: return None def run(self, headless=True, timeout=600, background=False, daemon=False): @@ -683,7 +683,7 @@ rm {prompt_file} # Clean up prompt file try: os.unlink(prompt_file) - except: + except Exception: pass return True @@ -728,7 +728,7 @@ rm {prompt_file} # Clean up try: os.unlink(prompt_file) - except: + except Exception: pass return False @@ -808,7 +808,7 @@ rm {prompt_file} # Clean up try: os.unlink(prompt_file) - except: + except Exception: pass if result.returncode == 0: @@ -927,7 +927,7 @@ try: # Clean up try: os.unlink(prompt_file) - except: + except Exception: pass if result.returncode == 0: diff --git a/src/skill_seekers/cli/pdf_extractor_poc.py b/src/skill_seekers/cli/pdf_extractor_poc.py index 21c74e1..c573cde 100755 --- a/src/skill_seekers/cli/pdf_extractor_poc.py +++ b/src/skill_seekers/cli/pdf_extractor_poc.py @@ -299,7 +299,7 @@ class PDFExtractor: comment_lines = sum( 1 for line in code.split("\n") if line.strip().startswith(("#", "//", "/*", "*", "--")) ) - total_lines = len([l for l in code.split("\n") if l.strip()]) + total_lines = len([l for line in code.split("\n") if line.strip()]) if total_lines > 0 and comment_lines / total_lines > 0.7: issues.append("Mostly comments") @@ -327,7 +327,7 @@ class PDFExtractor: score -= 2.0 # Factor 3: Number of lines - lines = [l for l in code.split("\n") if l.strip()] + lines = [l for line in code.split("\n") if line.strip()] if 2 <= len(lines) <= 50: score += 1.0 elif len(lines) > 100: diff --git a/src/skill_seekers/cli/setup_wizard.py b/src/skill_seekers/cli/setup_wizard.py index 2379e3a..4f30a56 100644 --- a/src/skill_seekers/cli/setup_wizard.py +++ b/src/skill_seekers/cli/setup_wizard.py @@ -4,7 +4,6 @@ Interactive Setup Wizard for Skill Seekers Guides users through installation options on first run. """ -import sys from pathlib import Path diff --git a/src/skill_seekers/cli/unified_scraper.py b/src/skill_seekers/cli/unified_scraper.py index 7099153..7819466 100644 --- a/src/skill_seekers/cli/unified_scraper.py +++ b/src/skill_seekers/cli/unified_scraper.py @@ -24,7 +24,7 @@ from typing import Any # Import validators and scrapers try: - from skill_seekers.cli.config_validator import ConfigValidator, validate_config + from skill_seekers.cli.config_validator import validate_config from skill_seekers.cli.conflict_detector import ConflictDetector from skill_seekers.cli.merge_sources import ClaudeEnhancedMerger, RuleBasedMerger from skill_seekers.cli.unified_skill_builder import UnifiedSkillBuilder diff --git a/src/skill_seekers/cli/upload_skill.py b/src/skill_seekers/cli/upload_skill.py index f7c67d2..6bb6f0d 100755 --- a/src/skill_seekers/cli/upload_skill.py +++ b/src/skill_seekers/cli/upload_skill.py @@ -24,7 +24,7 @@ from pathlib import Path # Import utilities try: - from utils import print_upload_instructions, validate_zip_file + from utils import print_upload_instructions except ImportError: sys.path.insert(0, str(Path(__file__).parent)) from utils import print_upload_instructions diff --git a/src/skill_seekers/cli/utils.py b/src/skill_seekers/cli/utils.py index 9d63caa..cd271f2 100755 --- a/src/skill_seekers/cli/utils.py +++ b/src/skill_seekers/cli/utils.py @@ -173,7 +173,7 @@ def validate_zip_file(zip_path: str | Path) -> tuple[bool, str | None]: if not zip_path.is_file(): return False, f"Not a file: {zip_path}" - if not zip_path.suffix == ".zip": + if zip_path.suffix != ".zip": return False, f"Not a .zip file: {zip_path}" return True, None diff --git a/src/skill_seekers/mcp/server.py b/src/skill_seekers/mcp/server.py index 34466b6..7fee57e 100644 --- a/src/skill_seekers/mcp/server.py +++ b/src/skill_seekers/mcp/server.py @@ -44,7 +44,6 @@ try: detect_patterns_tool, estimate_pages_tool, extract_config_patterns_tool, - run_subprocess_with_streaming, scrape_docs_tool, scrape_github_tool, scrape_pdf_tool, diff --git a/src/skill_seekers/mcp/server_fastmcp.py b/src/skill_seekers/mcp/server_fastmcp.py index 412cf4c..5b073a0 100644 --- a/src/skill_seekers/mcp/server_fastmcp.py +++ b/src/skill_seekers/mcp/server_fastmcp.py @@ -53,11 +53,9 @@ import sys # Import FastMCP MCP_AVAILABLE = False FastMCP = None -TextContent = None try: from mcp.server import FastMCP - from mcp.types import TextContent MCP_AVAILABLE = True except ImportError as e: diff --git a/src/skill_seekers/mcp/server_legacy.py b/src/skill_seekers/mcp/server_legacy.py index 5cbdc89..a208cc7 100644 --- a/src/skill_seekers/mcp/server_legacy.py +++ b/src/skill_seekers/mcp/server_legacy.py @@ -112,7 +112,7 @@ def run_subprocess_with_streaming(cmd, timeout=None): line = process.stderr.readline() if line: stderr_lines.append(line) - except: + except Exception: # Fallback for Windows (no select) time.sleep(0.1) @@ -834,7 +834,7 @@ async def scrape_docs_tool(args: dict) -> list[TextContent]: # Estimate: 30s per page + buffer timeout = max(3600, max_pages * 35) # Minimum 1 hour, or 35s per page - except: + except Exception: timeout = 14400 # Default: 4 hours # Add progress message diff --git a/src/skill_seekers/mcp/tools/packaging_tools.py b/src/skill_seekers/mcp/tools/packaging_tools.py index e8ab52a..bcb3fbe 100644 --- a/src/skill_seekers/mcp/tools/packaging_tools.py +++ b/src/skill_seekers/mcp/tools/packaging_tools.py @@ -84,7 +84,7 @@ def run_subprocess_with_streaming(cmd: list[str], timeout: int = None) -> tuple[ line = process.stderr.readline() if line: stderr_lines.append(line) - except: + except Exception: # Fallback for Windows (no select) time.sleep(0.1) diff --git a/src/skill_seekers/mcp/tools/scraping_tools.py b/src/skill_seekers/mcp/tools/scraping_tools.py index 2059401..eb1c5c0 100644 --- a/src/skill_seekers/mcp/tools/scraping_tools.py +++ b/src/skill_seekers/mcp/tools/scraping_tools.py @@ -90,7 +90,7 @@ def run_subprocess_with_streaming(cmd: list[str], timeout: int = None) -> tuple: line = process.stderr.readline() if line: stderr_lines.append(line) - except: + except Exception: # Fallback for Windows (no select) time.sleep(0.1) @@ -266,7 +266,7 @@ async def scrape_docs_tool(args: dict) -> list[TextContent]: # Estimate: 30s per page + buffer timeout = max(3600, max_pages * 35) # Minimum 1 hour, or 35s per page - except: + except Exception: timeout = 14400 # Default: 4 hours # Add progress message diff --git a/src/skill_seekers/mcp/tools/splitting_tools.py b/src/skill_seekers/mcp/tools/splitting_tools.py index 4c58d69..c67ea15 100644 --- a/src/skill_seekers/mcp/tools/splitting_tools.py +++ b/src/skill_seekers/mcp/tools/splitting_tools.py @@ -79,7 +79,7 @@ def run_subprocess_with_streaming(cmd, timeout=None): line = process.stderr.readline() if line: stderr_lines.append(line) - except: + except Exception: # Fallback for Windows (no select) time.sleep(0.1) diff --git a/tests/conftest.py b/tests/conftest.py index 9bc016f..6212d8c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -13,7 +13,7 @@ import pytest def pytest_configure(config): """Check if package is installed before running tests.""" try: - import skill_seekers + import skill_seekers # noqa: F401 except ModuleNotFoundError: print("\n" + "=" * 70) print("ERROR: skill_seekers package not installed") diff --git a/tests/test_bootstrap_skill.py b/tests/test_bootstrap_skill.py index c882b57..8507a4d 100644 --- a/tests/test_bootstrap_skill.py +++ b/tests/test_bootstrap_skill.py @@ -1,9 +1,10 @@ """Tests for the bootstrap skill script.""" import subprocess -import pytest from pathlib import Path +import pytest + @pytest.fixture def project_root(): diff --git a/tests/test_dependency_analyzer.py b/tests/test_dependency_analyzer.py index 04db585..ce337a2 100644 --- a/tests/test_dependency_analyzer.py +++ b/tests/test_dependency_analyzer.py @@ -16,7 +16,7 @@ import tempfile import unittest try: - from skill_seekers.cli.dependency_analyzer import DependencyAnalyzer, DependencyInfo, FileNode + from skill_seekers.cli.dependency_analyzer import DependencyAnalyzer ANALYZER_AVAILABLE = True except ImportError: diff --git a/tests/test_git_sources_e2e.py b/tests/test_git_sources_e2e.py index 2f3d532..92af08e 100644 --- a/tests/test_git_sources_e2e.py +++ b/tests/test_git_sources_e2e.py @@ -26,8 +26,8 @@ from skill_seekers.mcp.source_manager import SourceManager # Check if MCP is available try: - import mcp - from mcp.types import TextContent + import mcp # noqa: F401 + from mcp.types import TextContent # noqa: F401 MCP_AVAILABLE = True except ImportError: diff --git a/tests/test_github_scraper.py b/tests/test_github_scraper.py index 0edcd5a..c0bee2d 100644 --- a/tests/test_github_scraper.py +++ b/tests/test_github_scraper.py @@ -24,7 +24,7 @@ from pathlib import Path from unittest.mock import Mock, patch try: - from github import Github, GithubException + from github import Github, GithubException # noqa: F401 PYGITHUB_AVAILABLE = True except ImportError: diff --git a/tests/test_how_to_guide_builder.py b/tests/test_how_to_guide_builder.py index e40a594..2bd4ecb 100644 --- a/tests/test_how_to_guide_builder.py +++ b/tests/test_how_to_guide_builder.py @@ -235,7 +235,7 @@ class TestWorkflowGrouper(unittest.TestCase): # Should create 2 groups (test_user.py and test_database.py) self.assertEqual(len(grouped), 2) # Check that groups were created (titles are auto-generated from file names) - self.assertTrue(all(isinstance(k, str) for k in grouped.keys())) + self.assertTrue(all(isinstance(k, str) for k in grouped)) def test_group_by_test_name(self): """Test grouping workflows by test name patterns""" diff --git a/tests/test_issue_219_e2e.py b/tests/test_issue_219_e2e.py index a3234ab..42fb3cb 100644 --- a/tests/test_issue_219_e2e.py +++ b/tests/test_issue_219_e2e.py @@ -28,7 +28,7 @@ class TestIssue219Problem1LargeFiles(unittest.TestCase): def setUp(self): """Set up test environment""" try: - from github import Github, GithubException + from github import Github, GithubException # noqa: F401 self.PYGITHUB_AVAILABLE = True except ImportError: @@ -340,9 +340,9 @@ class TestIssue219IntegrationAll(unittest.TestCase): # Verify we can import all fixed modules try: - from skill_seekers.cli import main - from skill_seekers.cli.enhance_skill import SkillEnhancer - from skill_seekers.cli.github_scraper import GitHubScraper + from skill_seekers.cli import main # noqa: F401 + from skill_seekers.cli.enhance_skill import SkillEnhancer # noqa: F401 + from skill_seekers.cli.github_scraper import GitHubScraper # noqa: F401 # All imports successful self.assertTrue(True, "All modules import successfully") diff --git a/tests/test_markdown_parsing.py b/tests/test_markdown_parsing.py index cb6db0c..763949d 100644 --- a/tests/test_markdown_parsing.py +++ b/tests/test_markdown_parsing.py @@ -97,7 +97,7 @@ plain code without language content, "https://example.com/docs/test.md" ) # Should only include .md links - md_links = [l for l in result["links"] if ".md" in l] + md_links = [l for line in result["links"] if ".md" in l] self.assertEqual(len(md_links), len(result["links"])) def test_extract_content_paragraphs(self): diff --git a/tests/test_mcp_git_sources.py b/tests/test_mcp_git_sources.py index 694283b..fb54444 100644 --- a/tests/test_mcp_git_sources.py +++ b/tests/test_mcp_git_sources.py @@ -11,7 +11,7 @@ import pytest # Test if MCP is available try: - import mcp + import mcp # noqa: F401 from mcp.types import TextContent MCP_AVAILABLE = True diff --git a/tests/test_mcp_server.py b/tests/test_mcp_server.py index df1a762..71a9fdd 100644 --- a/tests/test_mcp_server.py +++ b/tests/test_mcp_server.py @@ -21,8 +21,8 @@ from unittest.mock import MagicMock, patch _original_dir = os.getcwd() try: os.chdir("/tmp") # Change away from project directory - from mcp.server import Server - from mcp.types import TextContent, Tool + from mcp.server import Server # noqa: F401 + from mcp.types import TextContent, Tool # noqa: F401 MCP_AVAILABLE = True except ImportError: diff --git a/tests/test_pdf_advanced_features.py b/tests/test_pdf_advanced_features.py index 54e3ab7..7181e58 100644 --- a/tests/test_pdf_advanced_features.py +++ b/tests/test_pdf_advanced_features.py @@ -29,8 +29,8 @@ except ImportError: PYMUPDF_AVAILABLE = False try: - import pytesseract - from PIL import Image + import pytesseract # noqa: F401 + from PIL import Image # noqa: F401 TESSERACT_AVAILABLE = True except ImportError: diff --git a/tests/test_pdf_extractor.py b/tests/test_pdf_extractor.py index 6cab95c..25027cd 100644 --- a/tests/test_pdf_extractor.py +++ b/tests/test_pdf_extractor.py @@ -20,7 +20,7 @@ from pathlib import Path sys.path.insert(0, str(Path(__file__).parent.parent / "cli")) try: - import fitz # PyMuPDF + import fitz # noqa: F401 PyMuPDF PYMUPDF_AVAILABLE = True except ImportError: diff --git a/tests/test_pdf_scraper.py b/tests/test_pdf_scraper.py index 0c7a894..b1ed5d0 100644 --- a/tests/test_pdf_scraper.py +++ b/tests/test_pdf_scraper.py @@ -18,7 +18,7 @@ import unittest from pathlib import Path try: - import fitz # PyMuPDF + import fitz # noqa: F401 PyMuPDF PYMUPDF_AVAILABLE = True except ImportError: diff --git a/tests/test_unified_mcp_integration.py b/tests/test_unified_mcp_integration.py index f6a610a..98355aa 100644 --- a/tests/test_unified_mcp_integration.py +++ b/tests/test_unified_mcp_integration.py @@ -20,7 +20,7 @@ _original_dir = os.getcwd() MCP_AVAILABLE = False try: os.chdir("/tmp") # Change away from project directory - from mcp.types import TextContent + from mcp.types import TextContent # noqa: F401 MCP_AVAILABLE = True except ImportError: