-
Notifications
You must be signed in to change notification settings - Fork 521
Description
Prerequisites
- I have written a descriptive issue title.
- I have searched all open and closed issues to ensure it has not already been reported.
- I have read the troubleshooting guide.
- I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- 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 }]
Code_duFbPD8P7d
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
ms-vscode.powershell@202310
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 }]
Code_duFbPD8P7d
Running the script analyzer on this definition shows 4 issues.
Visuals
Logs
No response