PowerShell / PowerShell/vscode-powershell
PSScriptAnalyzer is unavailable when using the specific PowerShell statement
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 1.9k
- Forks
- 548
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
System Details
System Details Output
### VSCode version: 1.51.1 e5a624b788d92b8d34d1392e4c4d9789406efe8f x64
### VSCode extensions:
ms-vscode.powershell@2020.6.0
ms-vscode.powershell-preview@2020.9.0
### PSES version: 2.3.0.0
### PowerShell version:
Name Value
---- -----
PSVersion 5.1.19041.610
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.610
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Issue Description
PSScriptAnalyzer not works code when using PSUseCompatibleCmdlets rule only with with following.

Works when I run PSScriptAnalyzer from PowerShell Integrated Console via command Invoke-ScriptAnalyzer <filename.ps1>. When coment last line or PSUseCompatibleCmdlets rule section in PSScriptAnalyzer settings file it works

PSScriptAnalyzerSettings.psd1
@{
Rules = @{
PSUseCompatibleCmdlets = @{
'compatibility' = @("desktop-2.0-windows")
}
PSUseCompatibleCommands = @{
# Turns the rule on
Enable = $true
# Lists the PowerShell platforms we want to check compatibility with
TargetProfiles = @(
'ubuntu_x64_18.04_7.0.0_x64_3.1.2_core'
)
}
}
}
I tested when ms-vscode.powershell-preview was enabled and ms-vscode.powershell disabled, and next time when ms-vscode.powershell-preview was disabled and ms-vscode.powershell enabled - same results
Expected Behaviour
Script analysis should works.
Actual Behaviour
Script analysis not works.
Attached Logs
I sent the logs by e-mail to vscode-powershell@microsoft.com
Topic: [Issue 3155] PSScriptAnalyzer is unavailable when using the specific PowerShell statement - logs
Same problem as issue 3090, but the old one has closed and the problem still exists
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, das Problem in Visual Studio Code mit der bereitgestellten PSScriptAnalyzerSettings.psd1, der PSUseCompatibleCmdlets-Regel und den aufgeführten Zielprofilen zu reproduzieren. Vergleiche die Editoranalyse mit Invoke-ScriptAnalyzer aus der integrierten Konsole und prüfe anschließend die für Issue 3155 gesendeten Logs. Als abgeschlossen gilt die Aufgabe, wenn die Skriptanalyse im Editor mit diesen Einstellungen sowie über die Konsole funktioniert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- powershell, typescript, vscode
- Bereich
- developer-experience, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100