Quality: Fix recursive directory traversal to properly find all files#697
Conversation
…nd all files The `dirFiles` function in Runner.js has a bug in its recursive directory traversal. When a directory is passed, it should recursively find all files in all subdirectories. The current implementation likely has an issue where the `acc.remaining` counter isn't properly managed during recursion, causing the callback to fire prematurely before all subdirectories have been fully explored. Additionally, the `getFiles` function that processes the initial paths array needs to properly handle directories by recursing into them. Affected files: Runner.js Signed-off-by: andoan16 <33853760+andoan16@users.noreply.github.com>
|
|
@andoan16 is attempting to deploy a commit to the Meta Open Source Team on Vercel. A member of the Team first needs to authorize it. |
|
Hi @andoan16! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
✨ Code Quality
Problem
The
dirFilesfunction in Runner.js has a bug in its recursive directory traversal. When a directory is passed, it should recursively find all files in all subdirectories. The current implementation likely has an issue where theacc.remainingcounter isn't properly managed during recursion, causing the callback to fire prematurely before all subdirectories have been fully explored. Additionally, thegetFilesfunction that processes the initial paths array needs to properly handle directories by recursing into them.Severity:
highFile:
src/Runner.jsSolution
The
dirFilesfunction in Runner.js has a bug in its recursive directory traversal. When a directory is passed, it should recursively find all files in all subdirectories. The current implementation likely has an issue where theacc.remainingcounter isn't properly managed during recursion, causing the callback to fire prematurely before all subdirectories have been fully explored. Additionally, thegetFilesfunction that processes the initial paths array needs to properly handle directories by recursing into them.Changes
src/Runner.js(modified)Testing
🤖 About this PR
This pull request was generated by ContribAI, an AI agent
that helps improve open source projects. The change was:
If you have questions or feedback about this PR, please comment below.
We appreciate your time reviewing this contribution!
Closes #479