Skip to content

refactor: clean code#630

Open
rtritto wants to merge 1 commit intomongodb-js:mainfrom
rtritto:clean-code
Open

refactor: clean code#630
rtritto wants to merge 1 commit intomongodb-js:mainfrom
rtritto:clean-code

Conversation

@rtritto
Copy link
Copy Markdown
Contributor

@rtritto rtritto commented Mar 28, 2026

Description

Clean code

Checklist

Copilot AI review requested due to automatic review settings March 28, 2026 20:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors small pieces of the AST execution/safety-check logic in shell-bson-parser and makes minor cleanup tweaks in BSON-to-JS stringification in query-parser.

Changes:

  • Flattened nested if checks in executeAST / checkTree into a single compound condition.
  • Simplified checkSafeCall control flow by combining allowMethods + callee-type checks.
  • Minor cleanup in stringification: optional catch binding and using new RegExp(...) for validation.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/shell-bson-parser/src/eval.ts Refactors executeAST condition structure.
packages/shell-bson-parser/src/check.ts Refactors checkSafeCall and checkTree condition structure.
packages/query-parser/src/stringify.ts Minor cleanup in date/regExp stringification error handling/validation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants