Fix NameError in thd_analyzer when invoked as a module - #44
Conversation
sys was only imported under __main__, so the Windows launcher's 'from thd_analyzer import thd_analyzer' could hit NameError on the sys.exit path for empty invocations. Import sys at module scope. Co-authored-by: opencode <opencode@anomalyco.ai>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change moves the ChangesImport cleanup
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to This localized change fixes the empty-invocation failure path without introducing an actionable merge-blocking risk; it is merge-ready after normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #44 +/- ##
==========================================
- Coverage 80.54% 80.34% -0.20%
==========================================
Files 12 12
Lines 406 407 +1
==========================================
Hits 327 327
- Misses 79 80 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Problem
scripts/thd_analyzer.py called sys.exit from thd_analyzer() when no files were given, but sys was only imported under if name == 'main'. The Windows launcher (from thd_analyzer import thd_analyzer) could therefore hit NameError on the empty-invocation path.
Fix
Move import sys to module scope.
Tests
This is split out from the tests PR (#41); the launcher/empty-invocation test lives there and exercises the fixed path.
Summary by CodeRabbit