Skip to content

Separate compressed file list in FL hub#205

Open
bjk7119 wants to merge 1 commit into
mainfrom
simple
Open

Separate compressed file list in FL hub#205
bjk7119 wants to merge 1 commit into
mainfrom
simple

Conversation

@bjk7119
Copy link
Copy Markdown
Contributor

@bjk7119 bjk7119 commented May 20, 2026

Summary by CodeRabbit

  • Refactor
    • Updated JAR file classification handling in binary processing
    • Reorganized excluded binary processing logic for improved flow
    • Optimized output file generation mechanism

Review Change Stack

@bjk7119 bjk7119 self-assigned this May 20, 2026
@bjk7119 bjk7119 added the chore [PR/Issue] Refactoring, maintenance the code label May 20, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Warning

Rate limit exceeded

@bjk7119 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 56 minutes and 50 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1fd8919c-85a4-4bbd-a516-3276363ea0fb

📥 Commits

Reviewing files that changed from the base of the PR and between 11d2616 and 7c2ce26.

📒 Files selected for processing (1)
  • src/fosslight_binary/_simple_mode.py
📝 Walkthrough

Walkthrough

The PR modifies three core functions in the simple mode binary processing pipeline: JAR classification no longer treats .jar files as non-compressed, filtering logic is reordered to check exclusions earlier and removes control-flow short-circuiting after compression detection, and output writing is refactored to construct file content strings before file operations.

Changes

Simple Mode Processing Pipeline

Layer / File(s) Summary
JAR compression classification
src/fosslight_binary/_simple_mode.py
is_compressed_file removes the special-case early return for .jar files, so JARs are now evaluated through standard compressed-file detection logic rather than being explicitly marked non-compressed.
Exclusion and compression filtering
src/fosslight_binary/_simple_mode.py
exclude_bin_for_simple_mode reorders to check bin.exclude before compression tests and removes the continue after compressed-file detection, allowing compressed files to continue into further processing instead of being skipped.
Output writing refactoring
src/fosslight_binary/_simple_mode.py
print_simple_mode refactors both compressed-file and binary-file list output by building a content string before calling write_txt_file, adjusting how success and error states are tracked for each list.

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Separate compressed file list in FL hub' directly relates to the main change of refactoring how compressed files are handled and separated in the output logic of the pull request.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch simple

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/fosslight_binary/_simple_mode.py (1)

91-105: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Result state leaks between the two file writes.

msg and output_file are reused across both write paths, so the second result can carry stale values from the first write.

Suggested fix
 def print_simple_mode(compressed_list_txt, simple_bin_list_txt, compressed_list, bin_list):
     results = []
-    success = True
-    msg = ""
-    output_file = ""
     if compressed_list:
+        msg = ""
+        output_file = ""
         content = "\n< Compressed File List >\n" + convert_list_to_str(compressed_list)
         success, error = write_txt_file(compressed_list_txt, content)
         if success:
             output_file = compressed_list_txt
         else:
             msg = f"Error to write compressed list file for simple mode : {error}"
         results.append(tuple([success, msg, output_file]))
     if bin_list:
+        msg = ""
+        output_file = ""
         content = "< Binary List >\n" + convert_list_to_str(bin_list)
         success, error = write_txt_file(simple_bin_list_txt, content)
         if success:
             output_file = simple_bin_list_txt
         else:
             msg = f"Error to write binary list file for simple mode : {error}"
         results.append(tuple([success, msg, output_file]))
     return results
🤖 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_binary/_simple_mode.py` around lines 91 - 105, The results for
the two write operations leak state because msg and output_file are reused;
modify each write block (the compressed list write and the binary list write
that call write_txt_file) to initialize fresh local variables (e.g., msg_local
and output_file_local) before the if/else, set them in both success and failure
branches, and append tuple([success, msg_local, output_file_local]) to results;
ensure you reference the existing symbols compressed_list_txt,
simple_bin_list_txt, write_txt_file, compressed_list and bin_list so the
variables are scoped per write and no stale values are carried between the two
blocks.
🤖 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.

Inline comments:
In `@src/fosslight_binary/_simple_mode.py`:
- Around line 28-34: The compressed entries are being appended to both
compressed_list and bin_list; inside the loop that iterates over bins (the block
using bin.exclude, is_compressed_file(bin.bin_name_with_path), compressed_list
and bin_list), ensure compressed files are not added to bin_list—either append
to compressed_list and immediately continue the loop or use an else branch so
only non-compressed files are appended to bin_list; update the loop in
_simple_mode.py where is_compressed_file(...) is checked to prevent
double-appending.

---

Outside diff comments:
In `@src/fosslight_binary/_simple_mode.py`:
- Around line 91-105: The results for the two write operations leak state
because msg and output_file are reused; modify each write block (the compressed
list write and the binary list write that call write_txt_file) to initialize
fresh local variables (e.g., msg_local and output_file_local) before the
if/else, set them in both success and failure branches, and append
tuple([success, msg_local, output_file_local]) to results; ensure you reference
the existing symbols compressed_list_txt, simple_bin_list_txt, write_txt_file,
compressed_list and bin_list so the variables are scoped per write and no stale
values are carried between the two blocks.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f5dd9f54-7598-4bf0-a961-8251b2e7ee01

📥 Commits

Reviewing files that changed from the base of the PR and between 248dc11 and 11d2616.

📒 Files selected for processing (1)
  • src/fosslight_binary/_simple_mode.py

Comment thread src/fosslight_binary/_simple_mode.py Outdated
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.

1 participant