syntastic icon indicating copy to clipboard operation
syntastic copied to clipboard

Feature: PowerShell checker

Open whitedwarfsun opened this issue 7 years ago • 0 comments

It would be nice to have a checker for PowerShell.

Ingredients:

  • https://github.com/PowerShell/PSScriptAnalyzer

Presumable requirements:

  • Obviously, Windows because PSScriptAnalyzer is available only as a PowerShell module.
  • https://github.com/Microsoft/WSL : As Syntastic will not run in PowerShell, bash console will be necessary.

Current working (!) setup: With

au FileType ps1 let &makeprg="cd /mnt/c && powershell.exe 'Invoke-ScriptAnalyzer " . substitute(expand("%:p"), "/mnt/c/", "C:\\", "") . ' -EA SilentlyContinue \| ForEach-Object { (\"/mnt/c$((Split-Path -NoQualifier $_.ScriptPath) -replace \"\\\\\", \"/\")\", $_.Line, $_.Column, $_.Severity.ToString()[0], \"[$($_.RuleName)] $($_.Message)$(If ($_.SuggestedCorrections.Description) { \" FIX: $($_.SuggestedCorrections.Description)\" })\") -join \":\"}' . "'"
au FileType ps1 set errorformat=%f:%l:%c:%t:%m

, I am able to execute :make and will get my quickfix list filled.

Unfortunately, I have no deep insights into checkers and will not be able to get them in the near future. When someone is willing to write this up, I can assist in testing for sure.

whitedwarfsun avatar Aug 10 '18 13:08 whitedwarfsun