Closed
Description
Steps to reproduce
Create file/folder structure as how in the image:
- create "test" folder.
- create "Target.ps1" in it (can be empty).
- create file in 2 sub folders ".\sub\sub2\test.ps1" with
& ..\..\Target.ps1
- open "test" folder in VSCode (if it already open then F1 > "Reload Window"
get false positive:
{
"resource": "/c:/temp/sub/sub2/test.ps1",
"owner": "_generated_diagnostic_collection_name_#3",
"code": "PSAvoidUsingCmdletAliases",
"severity": 4,
"message": "'..\\..\\Target.ps1' is implicitly aliasing 'Get-..\\..\\Target.ps1' because it is missing the 'Get-' prefix. This can introduce possible problems and make scripts hard to maintain. Please consider changing command to its full name.",
"source": "PSScriptAnalyzer",
"startLineNumber": 1,
"startColumn": 3,
"endLineNumber": 1,
"endColumn": 19
}
Environment data
PS C:\temp> $PSVersionTable
Name Value
---- -----
PSVersion 7.0.0-preview.5
PSEdition Core
GitCommitId 7.0.0-preview.5
OS Microsoft Windows 10.0.18362
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
PS C:\temp> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.18.3
1.18.1
1.18.0