ajeetdsouza / zoxide

A smarter cd command. Supports all major shells.
MIT License
22.55k stars 548 forks source link

PowerShell warning: Invoke-Expression is used. Please remove Invoke-Expression... #656

Closed stax76 closed 8 months ago

stax76 commented 10 months ago

VS Code shows this WARNING:

Invoke-Expression is used. Please remove Invoke-Expression from script and find other options instead.PSScriptAnalyzer(PSAvoidUsingInvokeExpression)

How do I get rid of this warning?

ajeetdsouza commented 8 months ago

zoxide generates an initialization script which is evaluated by PowerShell using Invoke-Expression. It's the same mechanism used by similar tools like atuin, starship. etc.

Invoke-Expression can be unsafe when run on untrusted text input, but in this case it's perfectly fine to use. I would suggest looking for a way to disable the warning in VS Code.