Skip to content

Add Name as a positional parameter for Get-ScriptAnalyzerRule #526

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 1 commit into from
May 10, 2016
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/Commands/GetScriptAnalyzerRuleCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public SwitchParameter RecurseCustomRulePath
/// <summary>
/// Name: The name of a specific rule to list.
/// </summary>
[Parameter(Mandatory = false)]
[Parameter(Mandatory = false, Position = 1)]
[ValidateNotNullOrEmpty]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public string[] Name
Expand Down
7 changes: 6 additions & 1 deletion Tests/Engine/GetScriptAnalyzerRule.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,15 @@ Describe "Test Name parameters" {
($rules | Where-Object {$_.RuleName -eq $approvedVerbs}).Count | Should Be 1
}

It "Get Rules with no parameters supplied" {
It "get Rules with no parameters supplied" {
$defaultRules = Get-ScriptAnalyzerRule
$defaultRules.Count | Should be 41
}

It "is a positional parameter" {
$rules = Get-ScriptAnalyzerRule *alias*
$rules.Count | Should Be 1
}
}

Context "When used incorrectly" {
Expand Down