Closed
Description
With this function :
Function Measure-OptimizeForSatement{
[CmdletBinding()]
[OutputType([Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticRecord[]])]
Param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.Language.ForStatementAst]
$ForStatementAst
)
Invoke-ScriptAnalyzer return only the first occurence of ForStatementAst :
if($commentLines.Count -gt 2)
{
for($i = 1; $i -lt ($commentLines.count - 1); $i++)
{
$line = $commentLines[$i]
}
}
function TestScriptFileInfo
{
if($commentLines.Count -gt 2)
{
for($i = 1; $i -lt ($commentLines.count - 1); $i++)
{
$line = $commentLines[$i]
}
}
}
The occurence of ForStatementAst inside the function 'TestScriptFileInfo' is not 'visited'.
See the demo file.