Repository navigation
R35-T046: Simplify one responsibility in rename_files (File_Renamer.py) - #87
Open
challengerthe026-maker wants to merge 1 commit into
Open
challengerthe026-maker wants to merge 1 commit into
challengerthe026-maker wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR refactors
rename_filesinFileRenamer/File_Renamer.pyby extracting target filename formatting into a dedicated helper functioncompute_renamed_filename, separating string computation from filesystem side effects while strictly preserving public behavior.Related Issue
Fixes: #46
Type of Change
Changes Made
compute_renamed_filename(filename, new_name, counter).rename_files(directory, pattern, new_name)signature, parameter order, iteration semantics, andos.renameoperations.input()calls underif __name__ == '__main__':for headless import safety.FileRenamer/test_file_renamer.pycovering smallest valid input (1 matching file), ordinary valid input (multiple files with mixed matches), non-matching files, and extracted helper formatting.work/R35-T046/check.pyandwork/R35-T046/evidence.mdwith complete verification logs and automated pass/fail checks.Screenshots / Recordings
There are no UI changes.
Testing
python3 work/R35-T046/check.py: PASS (all assertion groups passed, ran 4 unittest cases).FORCE_WRONG=1 python3 work/R35-T046/check.py: FAIL (correctly caught deliberate mismatch and exited with code 1).python3 -m unittest discover -s "FileRenamer" -p "test_*.py": PASS (Ran 4 tests, OK).Checklist
Additional Notes
Work evidence and standalone check runner are located under
work/R35-T046/.