Skip to content

Improvements to Positional Parameters rule #301

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

Closed
raghushantha opened this issue Aug 28, 2015 · 4 comments
Closed

Improvements to Positional Parameters rule #301

raghushantha opened this issue Aug 28, 2015 · 4 comments
Assignees

Comments

@raghushantha
Copy link
Member

Need to make the following changes to make the rule more usable:

  1. Make the rule informational severity
  2. Only trigger if more than 3 positional parameters are used in a cmdlet invocation
  3. explore the usage of a white-list to limit the application to only certain cmdlets
@raghushantha
Copy link
Member Author

Here is the Pull request:
#306

@kapilmb kapilmb closed this as completed Sep 30, 2015
@rkeithhill
Copy link
Contributor

So I have 1.1.1 which was released on Nov 3rd. But I'm getting PSAvoidUsingPositionalParameters on this line:

$srvc = Get-WmiObject Win32_Service -ComputerName $computername -Filter "name=""$service""" -Credential $credential

This is only using one positional parameter. What gives?

FWIW, if this rule only fired on the use of three or more positional parameters, I think it should be a warning as it does impact the readability of the script. Also, by allowing two positional parameters, I'm not sure you need a whitelist - IMO.

@quoctruong
Copy link

Hi Rob, this is probably a bug. We are looking into it.

@quoctruong
Copy link

Closed with #406

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants