Skip to content

UseCmdletCorrectly : This rule only fires for the cmdlets / functions loaded in the default runspace #883

Closed
@LaurentDardenne

Description

@LaurentDardenne
 $sb={
 Function Get-MyCommand {
   param( 
    [Parameter(Mandatory=$true,Position=1)] 
   $ParamMandatory,
   
    [Parameter(Position=2)]
   $B,
   
    [Parameter(Position=3)]
   $C
  )
  "Test"
  }
  Get-MyCommand
  Write-verbose
 }
 Invoke-ScriptAnalyzer -ScriptDefinition "$sb"

This rule does not fire because it only calls the GetCommandInfo() method.

The test file does not contain this use case.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions