Skip to content

Take Bug fixes to Master #281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Engine/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public bool PositionalParameterUsed(CommandAst cmdAst)
/// <param name="name"></param>
/// <param name="commandType"></param>
/// <returns></returns>
public CommandInfo GetCommandInfo(string name, CommandTypes commandType = CommandTypes.All)
public CommandInfo GetCommandInfo(string name, CommandTypes commandType = CommandTypes.Alias | CommandTypes.Cmdlet | CommandTypes.Configuration | CommandTypes.ExternalScript | CommandTypes.Filter | CommandTypes.Function | CommandTypes.Script | CommandTypes.Workflow)
{
return Helper.Instance.MyCmdlet.InvokeCommand.GetCommand(name, commandType);
}
Expand Down
11 changes: 10 additions & 1 deletion Tests/Rules/AvoidPositionalParametersNoViolations.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,13 @@ Clear-Host
Split-Path -Path "Random" -leaf
Get-Process | Where-Object {$_.handles -gt 200}
get-service-computername localhost | where {($_.status -eq "Running") -and ($_.CanStop -eq $true)}
1, 2, $null, 4 | ForEach-Object {"Hello"}
1, 2, $null, 4 | ForEach-Object {"Hello"}
& "$env:Windir\System32\Calc.exe" Parameter1 Parameter2

# There was a bug in Positional Parameter rule that resulted in the rule being fired
# when using external application with absolute paths
# The below function is to validate the fix - rule must not get triggered
function TestExternalApplication
{
& "c:\Windows\System32\Calc.exe" parameter1
}