parse_repoclosure: skip empty lines #41

Merged
adamwill merged 1 commit from pr-skip-empty-line into main 2026-05-13 01:42:18 +00:00
Owner

Looks like we can get empty lines in the dnf repoclosure output
sometimes (not sure why). They break things, so we'll skip them.

Signed-off-by: Adam Williamson awilliam@redhat.com

Looks like we can get empty lines in the `dnf repoclosure` output sometimes (not sure why). They break things, so we'll skip them. Signed-off-by: Adam Williamson <awilliam@redhat.com>
parse_repoclosure: skip empty lines
Some checks failed
CI via Tox / tox (pull_request) Failing after 1m26s
58055e1b8d
Looks like we can get empty lines in the `dnf repoclosure` output
sometimes (not sure why). They break things, so we'll skip them.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
Author
Owner

Embarrassing admission: I do not actually understand why this causes bad results in parse_repoclosure, but somehow it does. I suspect handle_preexisting winds up doing something unexpected. I should maybe robustify that a bit.

Embarrassing admission: I do not actually understand *why* this causes bad results in `parse_repoclosure`, but somehow it does. I suspect `handle_preexisting` winds up doing something unexpected. I should maybe robustify that a bit.
adamwill force-pushed pr-skip-empty-line from 58055e1b8d
Some checks failed
CI via Tox / tox (pull_request) Failing after 1m26s
to 0c8c61e741
All checks were successful
CI via Tox / tox (pull_request) Successful in 1m23s
AI Code Review / ai-review (pull_request_target) Successful in 17s
2026-05-13 01:33:22 +00:00
Compare

AI Code Review

📋 MR Summary

This PR updates the parse_repoclosure function to skip empty lines in the dnf repoclosure output.

  • Key Changes:
    • Added a check to skip empty lines during the parsing of dnf repoclosure output in rmdepcheck.py.
    • Added an empty line to the test data file tests/testdata/test_parse_repoclosure.txt to verify the fix.
  • Impact: rmdepcheck.py, tests/testdata/test_parse_repoclosure.txt
  • Risk Level: 🟢 Low - The change simply skips empty lines during parsing, which is a common and safe practice when processing shell command output. It is backed by a test data addition.

Detailed Code Review

The change correctly addresses the issue of unexpected empty lines in the dnf repoclosure output by filtering them out early in the processing loop. This is a robust and straightforward approach to handling potential malformed input in a line-by-line parser. The inclusion of an empty line in the test data ensures this behavior is covered.

📂 File Reviews

📄 `rmdepcheck.py` - Updated `parse_repoclosure` to ignore empty or whitespace-only lines.
  • Minor [Logic]: The logic simply skips empty lines, which prevents subsequent matching logic from failing or behaving unpredictably. This correctly handles the blank lines.

Summary

  • Overall Assessment: The changes introduce a simple and effective fix for empty lines in the parser input, with corresponding test data updates. No critical issues were identified.

🤖 AI Code Review | Generated with ai-code-review | Model: gemini-3.1-pro-preview

⚠️ AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.

## AI Code Review ### 📋 MR Summary This PR updates the `parse_repoclosure` function to skip empty lines in the `dnf repoclosure` output. - **Key Changes:** - Added a check to skip empty lines during the parsing of `dnf repoclosure` output in `rmdepcheck.py`. - Added an empty line to the test data file `tests/testdata/test_parse_repoclosure.txt` to verify the fix. - **Impact:** rmdepcheck.py, tests/testdata/test_parse_repoclosure.txt - **Risk Level:** 🟢 Low - The change simply skips empty lines during parsing, which is a common and safe practice when processing shell command output. It is backed by a test data addition. ### Detailed Code Review The change correctly addresses the issue of unexpected empty lines in the `dnf repoclosure` output by filtering them out early in the processing loop. This is a robust and straightforward approach to handling potential malformed input in a line-by-line parser. The inclusion of an empty line in the test data ensures this behavior is covered. #### 📂 File Reviews <details> <summary><strong>📄 `rmdepcheck.py`</strong> - Updated `parse_repoclosure` to ignore empty or whitespace-only lines.</summary> - **Minor** [Logic]: The logic simply skips empty lines, which prevents subsequent matching logic from failing or behaving unpredictably. This correctly handles the blank lines. </details> ### ✅ Summary - **Overall Assessment:** The changes introduce a simple and effective fix for empty lines in the parser input, with corresponding test data updates. No critical issues were identified. --- 🤖 **AI Code Review** | Generated with [ai-code-review](https://gitlab.com/redhat/edge/ci-cd/ai-code-review) | **Model:** `gemini-3.1-pro-preview` ⚠️ *AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.*
Author
Owner

Oh, wait, yeah, obviously I see why it causes problems: the empty line(s) are treated as a dependency issue. It/they won't get dropped out by handle_preexisting unless there's exactly one empty line in each raw output, I think. So in any other case we'll wind up printing something like:

New dependency problems in the tested packages themselves:
package: rust-cargo-vendor-filterer-devel-0.5.18-5.eln156.noarch from /var/tmp/rdcelnrepoi_l_nn_x/Extras
  

where each blank line is essentially "passed through" from a blank line in the raw output.

Oh, wait, yeah, obviously I see why it causes problems: the empty line(s) are treated as a dependency issue. It/they won't get dropped out by `handle_preexisting` unless there's exactly one empty line in each raw output, I think. So in any other case we'll wind up printing something like: ``` New dependency problems in the tested packages themselves: package: rust-cargo-vendor-filterer-devel-0.5.18-5.eln156.noarch from /var/tmp/rdcelnrepoi_l_nn_x/Extras ``` where each blank line is essentially "passed through" from a blank line in the raw output.
adamwill deleted branch pr-skip-empty-line 2026-05-13 01:42:18 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
quality/rmdepcheck!41
No description provided.