Skip to content

Commit 414519b

Browse files
fix: Initialize logger before use in github_scraper.py
Fixes Issue #190 - "name 'logger' is not defined" error **Problem:** - Logger was used at line 40 (in code_analyzer import exception) - Logger was defined at line 47 - Caused runtime error when code_analyzer import failed **Solution:** - Moved logging.basicConfig() and logger initialization to lines 34-39 - Now logger is defined BEFORE the code_analyzer import block - Warning message now works correctly when code_analyzer is missing **Testing:** - ✅ All 22 GitHub scraper tests pass - ✅ Logger warning appears correctly when code_analyzer missing - ✅ No similar issues found in other CLI files Closes #190
1 parent 50e0bfd commit 414519b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/skill_seekers/cli/github_scraper.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131
print("Error: PyGithub not installed. Run: pip install PyGithub")
3232
sys.exit(1)
3333

34+
# Configure logging FIRST (before using logger)
35+
logging.basicConfig(
36+
level=logging.INFO,
37+
format='%(asctime)s - %(levelname)s - %(message)s'
38+
)
39+
logger = logging.getLogger(__name__)
40+
3441
# Import code analyzer for deep code analysis
3542
try:
3643
from .code_analyzer import CodeAnalyzer
@@ -39,13 +46,6 @@
3946
CODE_ANALYZER_AVAILABLE = False
4047
logger.warning("Code analyzer not available - deep analysis disabled")
4148

42-
# Configure logging
43-
logging.basicConfig(
44-
level=logging.INFO,
45-
format='%(asctime)s - %(levelname)s - %(message)s'
46-
)
47-
logger = logging.getLogger(__name__)
48-
4949

5050
class GitHubScraper:
5151
"""

0 commit comments

Comments
 (0)