PowerShell / PowerShell/PSScriptAnalyzer

AvoidUsingPositionalParameters : rule is triggered only for the built-in functions

Open
#955 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area - Rules Issue - Bug
Dominant language
C#
Stars
2.2k
Forks
414
Avg merge
13h 1m
Merged PRs (30d)
2

Description

Steps to reproduce

function foo { param ( $a, $b, $c ) "boo" }

Invoke-ScriptAnalyzer -ScriptDefinition 'foo a b c'

Expected behavior

Rule AvoidUsingPositionalParameters is triggered.

Actual behavior

The rule is not triggered

Environment data

> $PSVersiontable  
Name                           Value                                                                                                                                                                                                                                                     
----                           -----                                                                                                                                                                                                                                                     
PSVersion                      6.0.1                                                                                                                                                                                                                                                     
PSEdition                      Core                                                                                                                                                                                                                                                      
GitCommitId                    v6.0.1                                                                                                                                                                                                                                                    
OS                             Linux 4.13.0-37-generic #42~16.04.1-Ubuntu SMP Wed Mar 7 16:03:28 UTC 2018                                                                                                                                                                                
Platform                       Unix                                                                                                                                                                                                                                                      
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                                                                                                   
PSRemotingProtocolVersion      2.3                                                                                                                                                                                                                                                       
SerializationVersion           1.1.0.1                                                                                                                                                                                                                                                   
WSManStackVersion              3.0          

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the supplied PowerShell function and Invoke-ScriptAnalyzer command, then locate the AvoidUsingPositionalParameters rule in the repository. Trace why the rule handles built-in functions but not this user-defined function. Done means the supplied example triggers the rule and a regression test covers it.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.