-
Notifications
You must be signed in to change notification settings - Fork 399
Closed
Labels
Description
I noticed quotes aren't smartly replaced when used in #Requires
statements.
Steps to reproduce
Look at the following lines. Note that the double quote chars probably don't need to be used on that first line, but I don't think it's an error to use them. And when they are used, they should be processed properly by PSScriptAnalyzer.
#Requires -Modules "Az.Accounts"
#Requires -Modules @{ ModuleName="Pester"; RequiredVersion='4.9.0' }
Expected behavior
I had expected the double quote chars to be replaced by single quote chars, like this:
#Requires -Modules 'Az.Accounts'
#Requires -Modules @{ ModuleName='Pester'; RequiredVersion='4.9.0' }
Actual behavior
The quotes remain unchanged.
#Requires -Modules "Az.Accounts"
#Requires -Modules @{ ModuleName="Pester"; RequiredVersion='4.9.0' }
It seems PSScriptAnalyzer treats #Requires
lines as mere comments and doesn't process them.
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.17763.5830
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.5830
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.22.0
1.22.0