Fix xtce_converter CLI crash with gem_name nil and PythonProxy .class#2841
Conversation
Two bugs prevented the xtce_converter from running via CLI: 1. plugin_model.rb: gem_name was only set when gem_file_path was nil, causing a NoMethodError on line 234 when gem_file_path was passed directly by the xtce_converter. 2. xtce_converter.rb: PythonProxy overrides .class to return a String (the Python class path) rather than a Ruby Class object, so calling .class.name on a PythonProxy conversion failed for Python-based targets like INST2. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2841 +/- ##
==========================================
- Coverage 78.66% 78.65% -0.02%
==========================================
Files 667 667
Lines 54452 54458 +6
Branches 731 731
==========================================
- Hits 42834 42833 -1
- Misses 11538 11545 +7
Partials 80 80
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| gem_name = plugin_hash['name'].split("__")[0] | ||
| gem_file_path = OpenC3::GemModel.get(gem_name) | ||
| else | ||
| gem_name = File.basename(gem_file_path) |
There was a problem hiding this comment.
I think I agree with SonarQube here -- if / else would be much easier to read 😅
There was a problem hiding this comment.
This will fix a totally separate bug I've noticed -- the openc3cli validate fails if public/ is in the directory list, but this will fix that issue.
Without public in the gemspec, the gem doesn't contain public/store_img.png. So line 232 (File.exist?) is false, img_path stays nil, and line 234's if img_path guard prevents the nil .split from ever executing.
|
Fix xtce_converter CLI crash with gem_name nil and PythonProxy .class



Two bugs prevented the xtce_converter from running via CLI:
plugin_model.rb: gem_name was only set when gem_file_path was nil, causing a NoMethodError on line 234 when gem_file_path was passed directly by the xtce_converter.
xtce_converter.rb: PythonProxy overrides .class to return a String (the Python class path) rather than a Ruby Class object, so calling .class.name on a PythonProxy conversion failed for Python-based targets like INST2.
closes #2837