Skip to content

POWERSHELL

Linters

Linter Additional
powershell
POWERSHELL_POWERSHELL
GitHub stars autofix
powershell_formatter
POWERSHELL_POWERSHELL_FORMATTER
GitHub stars formatter

Linted files

  • File extensions:
    • .ps1
    • .psm1
    • .psd1
    • .ps1xml
    • .pssc
    • .psrc
    • .cdxml

Configuration in MegaLinter

Variable Description Default value
POWERSHELL_PRE_COMMANDS List of bash commands to run before the linters None
POWERSHELL_POST_COMMANDS List of bash commands to run after the linters None
POWERSHELL_FILTER_REGEX_INCLUDE Custom regex including filter
POWERSHELL_FILTER_REGEX_EXCLUDE Custom regex excluding filter

Behind the scenes

Installation

  • Dockerfile commands :
RUN curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.4.2/powershell-7.4.2-linux-musl-x64.tar.gz -o /tmp/powershell.tar.gz \
    && mkdir -p /opt/microsoft/powershell/7 \
    && tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/7 \
    && chmod +x /opt/microsoft/powershell/7/pwsh \
    && ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh