Skip to content

Commit ba4cada

Browse files
committed
C#: Update the cs/unused-collection query.
1 parent b709a88 commit ba4cada

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

csharp/ql/src/Likely Bugs/Collections/WriteOnlyContainer.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ where
2323
) and
2424
forex(Access a | a = v.getAnAccess() |
2525
a = any(ModifierMethodCall m).getQualifier() or
26-
a = any(Assignment ass | ass.getRValue() instanceof ObjectCreation).getLValue()
26+
a = any(AssignExpr ass | ass.getRValue() instanceof ObjectCreation).getLValue() or
27+
a =
28+
any(LocalVariableDeclAndInitExpr ass | ass.getRValue() instanceof ObjectCreation).getLValue()
2729
) and
2830
not v = any(ForeachStmt fs).getVariable() and
2931
not v = any(BindingPatternExpr vpe).getVariableDeclExpr().getVariable() and

0 commit comments

Comments
 (0)