Skip to content

False positive: "is implicitly aliasing 'Get-..\..\Target.ps1'" on file path? #1369

Description

@ili101

Steps to reproduce

image
Create file/folder structure as how in the image:

  1. create "test" folder.
  2. create "Target.ps1" in it (can be empty).
  3. create file in 2 sub folders ".\sub\sub2\test.ps1" with & ..\..\Target.ps1
  4. 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      

Activity

  1. bergmeister commented on Jan 2, 2020

    @bergmeister
    Collaborator

    Thanks for the reminder in the other issue. I can confirm this is still happening unfortunately. I though I fixed that as part of a similar bug last year (PR #1216).
    Because it only happens in VS-Code when the test folder is the root folder, I am very sure it is due to some rogue entries getting into the PSSA cache, aka a scenario that unfortunately only happens within in the VS-Code integrated terminal of PSES, we should try to find a fix for this nevertheless, it just makes it harder to debug unfortunately

  2. ili101 commented on Apr 16, 2020

    @ili101
    Author

    Hi, don't know if it was fixed and re broken or if the fix did not work but in the last version of the VSCode extension (v2020.4.2-preview) the bug still exist.
    Can you please reopen this issue and give this another look?

  3. bergmeister commented on Apr 16, 2020

    @bergmeister
    Collaborator

    ili101 It is pending release of PSSA 1.19.0, that is currently being worked on

  4. ili101 commented on Apr 16, 2020

    @ili101
    Author

    Christoph Bergmeister (@bergmeister) When the next version is planed to come out (general time scale)? Thank you

  5. bergmeister commented on Apr 16, 2020

    @bergmeister
    Collaborator

    ili101 1.19.0 What we currently have in master is already feature complete for that. We are currently working on getting the signing in the release build to work again, so PR #1442 is going to be the last PR apart from one for the change log. We plan to offer the built and signed version to users for early testing hopefully this month and release next month. If things go well, it could happen faster.
    If you already want to test-drive it yourself, please find a local (unsigned) build below that you could install manually
    PSScriptAnalyzer.zip

  6. bergmeister commented on Apr 30, 2020

    @bergmeister
    Collaborator

    ili101 You can test-drive PSSA already from here as we've published the release candidate already to the PoshTestGallery. Pending no blocking issues, we will release this version next week to the PSGallery as well.

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

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