CodeQL library for C#
codeql/csharp-all 6.0.2 (changelog, source)
Search

Predicate missedSelectOpportunity

Holds if foreach statement fes can be converted to a .Select() call. That is, the loop variable is accessed only in the first statement of the block, the access is not a cast, the first statement is a local variable declaration statement s, and the initializer does not contain an await expression (since Select does not support async lambdas).

Import path

import Linq.Helpers
predicate missedSelectOpportunity(ForeachStmtGenericEnumerable fes, LocalVariableDeclStmt s)