Also included in the PowerShell extension for VSCode is the PSScriptAnalyzer module. It comes preloaded, and the static code analysis is triggered automatically for any piece of PowerShell code you are working on. We already covered the command-line use of PSScriptAnalyzer in Chapter 5, Writing Reusable Code.
PSScriptAnalyzer can be used very comfortably from within VSCode. A couple of rules are enabled by default, and by bringing up the command palette, you can select all of the rules you want to be applied:
This especially makes sense if you want to apply some enterprise-wide code policies that can be checked with the script analyzer. Any issues will be flagged in the Problems tab, and some of those issues, such as the use of Aliases, can be corrected automatically. This makes it easy even for inexperienced PowerShell developers to find and fix issues...