codinasion-archive / codinasion-monorepo

Community Monorepo
https://codinasion.org
MIT License
52 stars 167 forks source link

`BUG` Rename File Script #4311

Closed harshraj8843 closed 1 year ago

harshraj8843 commented 1 year ago

Description

The rename file script is creating new files instead of renaming them

https://github.com/codinasion/program/blob/ad631886f3a8a59df7e10e0a2edb3b5493669a0d/scripts/rename_files.py#L72-L80

Additional information

See 👉🏻 https://github.com/codinasion/program/commit/ad631886f3a8a59df7e10e0a2edb3b5493669a0d

Code of Conduct

hi-Kartik2004 commented 1 year ago

!assign

harshraj8843 commented 1 year ago

Hey @hi-Kartik2004, !assign command is only for good first issue !!!

Please choose another issue.

Thanks for your interest in contributing to this project.

harshraj8843 commented 1 year ago

Hey @hi-Kartik2004

Any idea why it is happening 🤔

hi-Kartik2004 commented 1 year ago

Hey @harshraj8843, I've tested the script out, and according to my testing, the script ran well and has no bugs, According to me, two different branches being merged that have the same file might have caused the issue as the file that is to be renamed already exists.

Note: this happens only when Someone adds an additional ".extension" file to the folder.

For example: If a contributor contributes a file to the folder find-string-length in cpp language with file name "calculate_string_len.cpp" The rename.py script will rename it to FindStringLength (i.e The folder name as per the naming convention specified in data/languages.json), But if another contributor tries to contribute another .cpp file to solve the same problem the rename.py script will not do anything as the FindStringLength.cpp file already exists and two files cannot have the exact same names with the same extensions. hence the extra file added by merging a branch that has an excess file for the same program in the same language that exists already will not be renamed.

PS: The script doesn't delete the additional file that exists in the folder. I've added this functionality in PR codinasion/program#5813