Quality: Refactor long sender functions and duplicated dry-run logic #196
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: low
Category: quality
Location:
src/client/client_send.c:307-427,src/client/client_send.c:429-485Description:
send_files()andsend_files_multithreaded()are both ~150+ lines and mix multiple responsibilities: argument handling, connection setup, directory scanning, manifest tracking, progress reporting, and cleanup. In addition, the dry-run logic is duplicated almost verbatim in both functions (src/client/client_send.c:307-328andsrc/client/client_send.c:429-449).Suggested fix:
dry_run_scan()helper that takes aConfig*and prints the dry-run report.send_files()into smaller functions:connect_client(config)send_files_loop(client, config, scanner, manifest)send_manifest_and_finish(client, manifest)send_files_multithreaded()similarly and reuse the connection/finish helpers.Labels: quality, refactoring