Problems tab does not include all problems reported by PSScriptAnalyzer
Prerequisites
- [X] I have written a descriptive issue title.
- [X] I have searched all open and closed issues to ensure it has not already been reported.
- [X] I have read the troubleshooting guide.
- [X] I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- [X] I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
- [ ] If this is a security issue, I have read the security issue reporting guidance.
Summary
Here is a sample function:
function Set-Numeric {[CmdletBinding()] param([Parameter(ValueFromPipeline)]$a,[string]$b,$c) $a.save(); $c |%{
@($a.$b.cells['A1:Z1'].value).indexof($_)+1 |set-ExcelColumn -ExcelPackage $a -WorksheetName $b -NumberFormat '$#,##0.00;-$#,##0.00;"- "'};
$a.save()}
When opening this in a file, I see a single problem:
[{ "resource": "Untitled-1", "owner": "_generated_diagnostic_collection_name_#3", "code": "PSAvoidUsingCmdletAliases", "severity": 4, "message": "'%' is an alias of 'ForEach-Object'. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content.", "source": "PSScriptAnalyzer", "startLineNumber": 1, "startColumn": 110, "endLineNumber": 1, "endColumn": 111 }]
Running the script analyzer on this definition shows 4 issues.
PowerShell Version
PS> $psversiontable
Name Value
---- -----
PSVersion 7.3.2
PSEdition Core
GitCommitId 7.3.2
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visual Studio Code Version
PS > code --version
1.75.1
441438abd1ac652551dbe4d408dfcec8a499b8bf
x64
Extension Version
[email protected]
Steps to Reproduce
Here is a sample function:
function Set-Numeric {[CmdletBinding()] param([Parameter(ValueFromPipeline)]$a,[string]$b,$c) $a.save(); $c |%{
@($a.$b.cells['A1:Z1'].value).indexof($_)+1 |set-ExcelColumn -ExcelPackage $a -WorksheetName $b -NumberFormat '$#,##0.00;-$#,##0.00;"- "'};
$a.save()}
When opening this in a file, I see a single problem:
[{ "resource": "Untitled-1", "owner": "_generated_diagnostic_collection_name_#3", "code": "PSAvoidUsingCmdletAliases", "severity": 4, "message": "'%' is an alias of 'ForEach-Object'. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content.", "source": "PSScriptAnalyzer", "startLineNumber": 1, "startColumn": 110, "endLineNumber": 1, "endColumn": 111 }]
Running the script analyzer on this definition shows 4 issues.
Visuals

Logs
No response
I don't think it's particularly well documented, but there's essentially a default set of rules based on a combination of settings in the client and defaults server-side that we provide to PSScriptAnalyzer, but you should be able to use your own settings file to enable all of them if you wish.
I don't think it's particularly well documented, but there's essentially a default set of rules based on a combination of settings in the client and defaults server-side that we provide to PSScriptAnalyzer, but you should be able to use your own settings file to enable all of them if you wish.
Those rules affect only the Code Formatting features, as far as I can see. I see no list of default rules at that link.
This issue has been marked as answered and has not had any activity in a day. It has been automatically closed for housekeeping purposes.
Hmm I'll check with @SeeminglyScience