Questions tagged [psscriptanalyzer]
7 questions
6
votes
1 answer
PSScriptAnalyzer is not working in my Visual Studio Code
I have it enable in settings (Script Analysis: Enable).
I have settings path sets to ScriptAnalyzerSettings.psd1
I can invoke Get-ScriptAnalyzerRule or Invoke-ScriptAnalyzer in PowerShell
Integrated Console and it works (and showing warnings/errors…

Tomasz Szymański
- 71
- 6
5
votes
1 answer
PowerShell Aliases, PSScriptAnalyzer and VSCode
Is there a way to suppress PSScriptAnalyzer from highlighting alias warnings? e.g.
'rm' is an alias of 'Remove-Item'. Aliases can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full…

YorSubs
- 3,194
- 7
- 37
- 60
2
votes
1 answer
How to create a case sensitive Hashtable without generating a PSScriptAnalyzer warning?
By default hash tables created by PowerShell (e.g. $hashtable = @{}) are case insensitive.
For my script I want to explicitly create a case sensitive hash table.
This can be done by:
$hashtable = [hashtable]::new()
or:
$hashtable = New-Object…

iRon
- 20,463
- 10
- 53
- 79
1
vote
1 answer
Powershell for Linux: Combining commands with pipe sign doesn't work
Any way to concatenate commands in Powershell for Linux?
This is what I'm trying to run:
pwsh -Command Invoke-ScriptAnalyzer -Path . | ConvertTo-Json | Out-File -FilePath "/home/administrator/scripts/test.json"
So, run the Invoke-ScriptAnalyzer,…

KeeperOfTheSevenKeys
- 69
- 1
- 10
0
votes
0 answers
Issue with two custom PSScriptAnalyzer rules in VS Code
I am having a strange issue with custom rules for PSScriptAnalyzer in VS Code.
VS Code: 1.78.2
PSScriptAnalyzer: 1.21.0
My PSScriptAnalyzer settings are unchanged by when I add second Measure- function to the Custom rules .psm1 file all Problems…

user21915071
- 1
- 1
0
votes
0 answers
PowerShell capture PSScriptAnalyzer logs line by line into array
I am using the PSScriptAnalyzer static code checker. When I run this example commnad Invoke-ScriptAnalyzer -Path .\MySuperLongLongFileName.ps1 -Settings PSGallery the code checker logs are presented in a table format. This format causes the script…

greg
- 1,118
- 1
- 20
- 40
0
votes
2 answers
Is there a way I can publish PS Script Analyzer results via Nunit (or similar) during a build pipeline?
I want to publish my static analysis results via Nunit. I am doing so with Pester however this is set in configuration settings with Pester. Is there a way I can do the equivalent when using PS Script Analyzer? I can't find information about it on…

i'i'i'i'i'i'i'i'i'i
- 157
- 3
- 13