GPT-4Code review

مساعد مراجعة الكود الآلي

مشاركة:
مساعد مراجعة الكود الآلي

لماذا تهم هذه المطالبة

Structured code review prompts catch more issues than vague requests. The numbered categories ensure comprehensive coverage.

فيم نستخدمها

Code review

المطالبة

Review the following code for: 1) Bugs and edge cases, 2) Performance issues, 3) Security vulnerabilities, 4) Readability improvements. For each issue found, explain why it matters and provide the corrected code. Be constructive, not critical.

النتيجة

I found 3 issues in your code:

1. **SQL Injection Risk** (Critical): The query string is interpolated directly. Use parameterized queries instead. 2. **Missing null check** on line 15: `user.email` could be undefined when the account is deactivated. 3. **Performance**: The nested loop on lines 22-30 is O(n²). Consider using a Map for O(n) lookup.

Structured code review prompts catch more issues than vague requests. The numbered categories ensure comprehensive coverage.

This prompt demonstrates a structured approach to code review, producing consistent, high-quality results that can be iterated upon.

مشاركة: