|
| 1 | +When reviewing code, focus on: |
| 2 | + |
| 3 | +## Security Critical Issues |
| 4 | +- Check for hardcoded secrets, API keys, or credentials. |
| 5 | +- Check for instances of potential method call injection, dynamic code execution, symbol injection or other code injection vulnerabilities. |
| 6 | + |
| 7 | +## Performance Red Flags |
| 8 | +- Spot inefficient loops and algorithmic issues. |
| 9 | +- Check for memory leaks and resource cleanup. |
| 10 | + |
| 11 | +## Code Quality Essentials |
| 12 | +- Methods should be focused and appropriately sized. If a method is doing too much, suggest refactorings to split it up. |
| 13 | +- Use clear, descriptive naming conventions. |
| 14 | +- Avoid encapsulation violations and ensure proper separation of concerns. |
| 15 | +- All public classes, modules, and methods should have clear documentation in Sphinx format. |
| 16 | + |
| 17 | +## PyMongo-specific Concerns |
| 18 | +- Do not review files within `pymongo/synchronous` or files in `test/` that also have a file of the same name in `test/asynchronous` unless the reviewed changes include a `_IS_SYNC` statement. PyMongo generates these files from `pymongo/asynchronous` and `test/asynchronous` using `tools/synchro.py`. |
| 19 | +- All asynchronous functions must not call any blocking I/O. |
| 20 | + |
| 21 | +## Review Style |
| 22 | +- Be specific and actionable in feedback. |
| 23 | +- Explain the "why" behind recommendations. |
| 24 | +- Acknowledge good patterns when you see them. |
| 25 | +- Ask clarifying questions when code intent is unclear. |
| 26 | + |
| 27 | +Always prioritize security vulnerabilities and performance issues that could impact users. |
| 28 | + |
| 29 | +Always suggest changes to improve readability and testability. For example, this suggestion seeks to make the code more readable, reusable, and testable: |
| 30 | + |
| 31 | +```python |
| 32 | +# Instead of: |
| 33 | +if user.email and "@" in user.email and len(user.email) > 5: |
| 34 | + submit_button.enabled = True |
| 35 | +else: |
| 36 | + submit_button.enabled = False |
| 37 | + |
| 38 | +# Consider: |
| 39 | +def valid_email(email): |
| 40 | + return email and "@" in email and len(email) > 5 |
| 41 | + |
| 42 | + |
| 43 | +submit_button.enabled = valid_email(user.email) |
| 44 | +``` |
0 commit comments