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

Predicate missedWhereOpportunity

Holds if foreach statement fes could be converted to a .Where() call. That is, first statement of the loop is an if, which accesses the loop variable, and the body of the if is either a continue or there’s nothing else in the loop than the if.

Import path

import Linq.Helpers
predicate missedWhereOpportunity(ForeachStmtGenericEnumerable fes, IfStmt is)