For the complete documentation index, see llms.txt. This page is also available as Markdown.

PowerShell

Language-specific information about the way that SonarQube Cloud supports the analysis of PowerShell.

Analysis Overview

The PowerShell analyzer is designed to perform static code analysis on PowerShell source code and scripts.

Language-specific properties

You can discover and update the PowerShell-specific properties in Your project > Administration > General Settings > Languages > PowerShell. See Configuration overview for more information about setting properties.

In-line suppression of issues

Adding the #NOSONAR comment at the end of the line will suppress all issues on that line.

SuppressMessage attribute

Use Diagnostics.CodeAnalysis.SuppressMessageAttribute to suppress a specific rule for a script, function, or parameter. The first argument is the rule key and the second argument should be an empty string.

function Invoke-Example {
    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('SXXXX', '', Justification = 'Because ...')]
    param()

    # ...
}

Last updated

Was this helpful?