Linter shows error SC1036 for correct powershell script

251 views Asked by At

In my Github project I have this snippet in my powershell script:

param (
    [string]$f,
    [string]$l 
)

The Super-linter shows me this error:

SC1036: '(' is invalid here. Did you forget to escape it?

but the code itself works. I also tried a disabling of this linter rule, but this was not working, unfortunately.

1

There are 1 answers

0
Nathan Mills On

PowerShell scripts shouldn't have #!/bin/bash interpreter line (shebang). This interpreter line might confuse the linter making it run shellcheck (which is for bash/sh scripts) instead of PSScriptAnalyzer (the powershell linter).

The correct interpreter line for PowerShell on Linux/Mac is #!/usr/bin/env pwsh. 1