Handle None values#287
Conversation
📝 WalkthroughWalkthrough
ChangesExcel cell normalization
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 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 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/fosslight_util/write_excel.py (1)
213-222: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winRestore truncation before writing Excel cells (
src/fosslight_util/write_excel.py:213-222).
Strings longer than Excel’s 32,767-character limit still reachworksheet.write()/write_string()here, so a single oversized value can raiseValueErrorand abort the export.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/fosslight_util/write_excel.py` around lines 213 - 222, `write_result_to_sheet` currently writes arbitrarily long strings directly to Excel cells, which can still trigger `ValueError` when a value exceeds Excel’s 32,767-character limit. Update the value handling in `write_result_to_sheet` in `write_excel.py` to truncate any string that is longer than the Excel cell limit before calling `worksheet.write()` or `worksheet.write_string()`, while preserving the existing URL-specific branch. Keep the fix localized to the `write_result_to_sheet` loop and ensure oversized values are safely shortened before being written.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/fosslight_util/write_excel.py`:
- Around line 213-222: `write_result_to_sheet` currently writes arbitrarily long
strings directly to Excel cells, which can still trigger `ValueError` when a
value exceeds Excel’s 32,767-character limit. Update the value handling in
`write_result_to_sheet` in `write_excel.py` to truncate any string that is
longer than the Excel cell limit before calling `worksheet.write()` or
`worksheet.write_string()`, while preserving the existing URL-specific branch.
Keep the fix localized to the `write_result_to_sheet` loop and ensure oversized
values are safely shortened before being written.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2c314c16-50ca-4fdd-b4e4-b9563cc725ec
📒 Files selected for processing (1)
src/fosslight_util/write_excel.py
b0740f8 to
e115197
Compare
- Convert None values to empty strings to avoid writing 'None'. - Store the string converted value to avoid calling str() repeatedly when checking and writing URL cells. Signed-off-by: Park Wonjae <wonjae.park@lge.com>
e115197 to
c8fbae3
Compare
Nonevalues are recorded as the string'None'when generating Excel reports