Skip to content

Commit 2e2eb68

Browse files
committed
upadate NullReferenceException rule
1 parent 76cd2e2 commit 2e2eb68

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/code_review_agent/reviewer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ def run_review(
147147
5. **PRAGMATISM:** Focus exclusively on **actual, present problems**. Your feedback must be actionable for the developer **right now**.
148148
6. **SUGGESTION FORMAT:** Your primary goal for the `suggestion` field is to provide a **direct code fix**.
149149
7. **AVOID REDUNDANT SUGGESTIONS:** DO NOT suggest a change that is identical to the existing code.
150-
8. **RESPECT GUARD CLAUSES:** If code is inside a `if (obj != null)` block, DO NOT report a potential `NullReferenceException`.
150+
8. **NULL REFERENCE SAFETY:** Respect null-safety mechanisms. DO NOT report potential `NullReferenceException` issues if:
151+
- The code is inside an explicit null-check block (e.g., `if (obj != null)`).
152+
- For .NET code, modern nullability syntax is used (e.g., nullable reference types `?` or the null-forgiving operator `!`).
151153
9. {custom_rules_instruction}
152154
153155

0 commit comments

Comments
 (0)