Skip to content

Commit b0a81dc

Browse files
committed
fix(qodo): refine optional chaining rule to exempt mutation and accept both null-check styles
1 parent e8e4aa9 commit b0a81dc

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎pr_compliance_checklist.yaml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ pr_compliances:
1717
success_criteria: "All identifiers follow the established naming patterns (camelCase, PascalCase, snake_case, etc.)"
1818
failure_criteria: "Inconsistent or non-standard naming that deviates from project conventions"
1919

20-
- title: "Prefer optional chaining over non-null assertions in tests"
20+
- title: "Prefer optional chaining over non-null assertions in test assertions"
2121
compliance_label: true
22-
objective: "Tests should use optional chaining (?.) instead of non-null assertions (!) after null checks."
23-
success_criteria: "Test assertions use expect(result).to.not.be.null followed by result?.property and result?.items ?? [] for iteration."
24-
failure_criteria: "Tests use result!.property or result!.items non-null assertions after null checks."
22+
objective: "Test property access in assertions should use optional chaining (?.) instead of non-null assertions (!). Non-null assertions remain acceptable for mutation or passing values to functions (e.g. repo.save(x!))."
23+
success_criteria: "Test assertions verify non-null (expect(x).to.not.be.null or expect(x).not.to.be.null) then access properties with optional chaining (x?.property). Iteration asserts array length before looping rather than defaulting to an empty array."
24+
failure_criteria: "Tests use result!.property for read-only access in assertions where optional chaining would suffice."
2525

2626
- title: "Remove AI-generated noise"
2727
compliance_label: true

0 commit comments

Comments
 (0)