I'm using Visual Studio Code to write my PowerShell Scripts.
I've installed the ms-vscode.powershell
PowerShell Extension for Visual Studio Code.
Whenever I use an Alias in my Script, the PSScriptAnalyzer
tells me to use the full CmdLet Name. This is kind of annoying because it also marks all aliases with a green curvy line.
How can I disable this?
Best Answer
There's three ways to do that.
Option 1 - Use the search function
>PowerShell: Select PS
then choosePowerShell: Select PSScriptAnalyzer Rules
PSAvoidUsingCmdletAliases
Confirm
Picture:
Option 2 - completely disable ScriptAnalysis
{}
Symbol on the top right corner"powershell.scriptAnalysis.enable": false
to your user settings on the right hand side (see screenshot below).CTRL + S
Screenshot:
Your Script Analyzer is now disabled and won't complain about Aliases anymore.
Option 3 - create a settings file and only disable Alias information
"powershell.scriptAnalysis.settingsPath": "C:\\foo\\bar\\FileName.psd1"
and save itHere's a picture of it:
Template (taken from https://github.com/PowerShell/vscode-powershell/blob/develop/examples/PSScriptAnalyzerSettings.psd1):