Skip to content

Handle None values#287

Merged
JustinWonjaePark merged 1 commit into
mainfrom
fix-excel-limit
Jul 3, 2026
Merged

Handle None values#287
JustinWonjaePark merged 1 commit into
mainfrom
fix-excel-limit

Conversation

@JustinWonjaePark

@JustinWonjaePark JustinWonjaePark commented Jul 2, 2026

Copy link
Copy Markdown
Contributor
  • Prevents the issue where None values ​​are recorded as the string 'None' when generating Excel reports

@JustinWonjaePark JustinWonjaePark self-assigned this Jul 2, 2026
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

write_result_to_sheet now normalizes each cell value once before branching, mapping None to an empty string and reusing the same string for URL-length checks and worksheet writes.

Changes

Excel cell normalization

Layer / File(s) Summary
Normalize cell values before write
src/fosslight_util/write_excel.py
write_result_to_sheet now converts each value once per cell, treats None as "", and uses the normalized string for both URL and default write paths.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is related to a real part of the change, but it undersells the main Excel cell-length truncation update.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-excel-limit

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@soimkim soimkim added the chore [PR/Issue] Refactoring, maintenance the code label Jul 2, 2026
Comment thread src/fosslight_util/write_excel.py Outdated
Comment thread src/fosslight_util/write_excel.py Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Restore truncation before writing Excel cells (src/fosslight_util/write_excel.py:213-222).
Strings longer than Excel’s 32,767-character limit still reach worksheet.write()/write_string() here, so a single oversized value can raise ValueError and 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

📥 Commits

Reviewing files that changed from the base of the PR and between 9d86da5 and b0740f8.

📒 Files selected for processing (1)
  • src/fosslight_util/write_excel.py

- 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>
@JustinWonjaePark JustinWonjaePark changed the title Truncate cell values exceeding maximum length Handle None values Jul 3, 2026
@JustinWonjaePark
JustinWonjaePark merged commit 5935171 into main Jul 3, 2026
8 checks passed
@JustinWonjaePark
JustinWonjaePark deleted the fix-excel-limit branch July 3, 2026 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore [PR/Issue] Refactoring, maintenance the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants