Skip to content

fix(cli): honor --folderoutput for xlsx output - #3117

Open
twelfthlabor wants to merge 1 commit into
sherlock-project:masterfrom
twelfthlabor:fix/xlsx-folderoutput
Open

twelfthlabor wants to merge 1 commit into
sherlock-project:masterfrom
twelfthlabor:fix/xlsx-folderoutput

Conversation

@twelfthlabor

@twelfthlabor twelfthlabor commented Sep 10, 2026

Copy link
Copy Markdown

Fixes #3115

Problem

--folderoutput is honored by the --txt and --csv branches, but the --xlsx branch hardcodes DataFrame.to_excel(f"{username}.xlsx", ...) and always writes to the current working directory, silently ignoring --folderoutput.

Fix

Mirror the csv branch's path handling verbatim in the xlsx branch: os.makedirs(folderoutput, exist_ok=True) + os.path.join(folderoutput, f"{username}.xlsx"). No changes to txt/csv branches, --output handling, or the response_time_s logic (#2891/#3077 territory — intentionally untouched).

Testing

  • Regression test test_xlsx_honors_folderoutput (offline, spies on pd.DataFrame.to_excel to capture the resolved path):
    • fails on master (CWD-relative path)
    • passes on this branch (path inside --folderoutput)
  • Real-write check: nonexistent/nested dir with spaces → auto-created, xlsx lands inside
  • Full offline suite: pytest tests -m "not online" -q → 15 passed
  • ruff check: zero new findings vs master

Verification

Independently re-verified on a fresh checkout: diff touches only the xlsx call site (+8/-1) and tests; csv mirror fidelity confirmed side-by-side; no---folderoutput behavior byte-identical to master.

The txt and csv branches join --folderoutput into the result path
(and create the directory if missing), but the xlsx branch hardcoded
f'{username}.xlsx', writing the spreadsheet to the current working
directory and silently ignoring --folderoutput.

Mirror the csv branch's path handling for the xlsx filename.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: --xlsx ignores --folderoutput (spreadsheet always written to CWD)

1 participant