Skip to content

psscriptanalyzer rules in Sudsy

PowerShellversion 1.25.0 (PowerShell Gallery; the version `scripts/parity.sh format invoke-formatter` saves)87% of its findings also reported92% of PowerShell files identical12 covered14 partial1 planned48 deferred

Every rule and setting of psscriptanalyzer in the parity catalog, with the Sudsy equivalent. The lint share is the part of psscriptanalyzer’s default set (in scope) whose findings Sudsy also reports on real-world code, with the preset that mirrors it. The format share is the part of real-world files that Sudsy formats to the same text as psscriptanalyzer. Where the tool has a page for an entry, the id links to it.

Status: covered; partial (the note says what differs); not yet (planned); deferred; not planned; SDK (a .NET SDK diagnostic does it).

Id Sudsy Status Note
PSPlaceOpenBrace formatter partial A brace after a command (ForEach-Object + line break + {) stays: joining it would change the meaning. No Allman option.
PSPlaceCloseBrace formatter covered
PSUseConsistentIndentation option powershell.format.indent_size covered
PSUseConsistentWhitespace formatter covered
PSAlignAssignmentStatement formatter covered
PSUseCorrectCasing - not yet needs the command and parameter tables of a PowerShell runtime
PSAvoidUsingCmdletAliases no-cmdlet-aliases partial The table is fixed (a Windows host’s); PSScriptAnalyzer reads the aliases of the host it runs on, so on Linux ls and cat are not aliases there, and user-defined aliases are not known. No fix that expands the alias. & ls is reported at the &.
PSAvoidUsingWriteHost no-print covered
PSAvoidUsingInvokeExpression no-eval covered
PSAvoidUsingConvertToSecureStringWithPlainText no-plain-text-secure-string covered
PSAvoidUsingWMICmdlet no-wmi-cmdlets covered
PSAvoidUsingPlainTextForPassword no-plain-text-password partial SuppressMessageAttribute is not honored (see the scope).
PSAvoidDefaultValueSwitchParameter no-default-true-switch partial Other values that evaluate to true (= 1) are not reported.
PSAvoidUsingEmptyCatchBlock no-empty-catch covered
PSUseApprovedVerbs approved-verbs partial Names without a dash are not checked; the verb list is fixed and cannot follow the host.
PSAvoidGlobalVars no-global-vars partial Variables inside strings, and Get-Variable -Scope Global, are not looked at.
PSAvoidTrailingWhitespace formatter covered
PSMisleadingBacktick no-misleading-backtick covered
PSPossibleIncorrectComparisonWithNull null-comparison-side partial The module does not report a left operand it knows to be a scalar (a parameter or variable of a non-array type); Sudsy has no types, so [string]$a … $a -eq $null is reported. A comparison whose expression also holds -and, -or or -xor at the same level is skipped (the expression is not split). No fix that swaps the operands.
PSAvoidAssignmentToAutomaticVariable no-automatic-variable-assignment partial The report is at the start of the parameter (its attributes included), the module’s at the variable, so a parameter with attributes on earlier lines differs in the line.
PSAvoidLongLines max-line-length covered
PSUseDeclaredVarsMoreThanAssignments unused-variable partial The shared scope model, where a name is looked up through the blocks around it, so a read in an inner block of a name the inner block assigns itself counts for the outer one; the module counts by name inside each block. A scope that reads $PSBoundParameters is not checked (a documented difference).
PSReviewUnusedParameter unused-parameter partial A read in a block inside the function counts; the module counts only reads in the function itself and in ForEach-Object and Where-Object blocks. Parameters written after the function name (function f($a)) are not checked.
PSUseCmdletCorrectly missing-mandatory-parameter partial Reads a table of the cmdlets that have a parameter mandatory in every parameter set (generated by scripts/gen_powershell_commands.ps1 from the built-in modules of PowerShell 7.7); the module asks the commands of its host, user functions included. A -name takes the next element as its value, which is how the module reads Write-Verbose -Verbose "x".
PSUseShouldProcessForStateChangingFunctions supports-should-process partial The verbs are the module’s (New, Set, Remove, Start, Stop, Restart, Reset, Update); the attribute is looked for in the whole text of the function, nested functions included.
PSUseSingularNouns singular-nouns partial The module asks an English pluralizer; Sudsy takes a noun ending in s as plural unless it ends in ss, us, is, as or is News, Series, Species, Data.
PSUseProcessBlockForPipelineCommand process-block-for-pipeline partial A process block anywhere in the function text counts, a nested one too.
PSAvoidUsingPositionalParameters - deferred Needs the parameter metadata of the called command (PowerShell’s command tables), which Sudsy does not have.
PSShouldProcess - deferred Needs the parameter metadata of the called command (PowerShell’s command tables), which Sudsy does not have.
PSAvoidOverwritingBuiltInCmdlets - deferred Needs the parameter metadata of the called command (PowerShell’s command tables), which Sudsy does not have.
PSUseCompatibleCmdlets - deferred Needs the compatibility profiles of PowerShell versions and platforms (command, type and syntax tables).
PSUseCompatibleCommands - deferred Needs the compatibility profiles of PowerShell versions and platforms (command, type and syntax tables).
PSUseCompatibleTypes - deferred Needs the compatibility profiles of PowerShell versions and platforms (command, type and syntax tables).
PSUseCompatibleSyntax - deferred Needs the compatibility profiles of PowerShell versions and platforms (command, type and syntax tables).
PSUseOutputTypeCorrectly - deferred Needs type inference of the output of the commands in the function.
PSMissingModuleManifestField - deferred Needs the semantics of a module manifest (Test-ModuleManifest, the module’s exports) or the bytes and layout of the files of a module.
PSUseToExportFieldsInManifest - deferred Needs the semantics of a module manifest (Test-ModuleManifest, the module’s exports) or the bytes and layout of the files of a module.
PSAvoidUsingDeprecatedManifestFields - deferred Needs the semantics of a module manifest (Test-ModuleManifest, the module’s exports) or the bytes and layout of the files of a module.
PSUseBOMForUnicodeEncodedFile - deferred Needs the semantics of a module manifest (Test-ModuleManifest, the module’s exports) or the bytes and layout of the files of a module.
PSUseUTF8EncodingForHelpFile - deferred Needs the semantics of a module manifest (Test-ModuleManifest, the module’s exports) or the bytes and layout of the files of a module.
PSDSCDscExamplesPresent - deferred Needs the semantics of a module manifest (Test-ModuleManifest, the module’s exports) or the bytes and layout of the files of a module.
PSDSCDscTestsPresent - deferred Needs the semantics of a module manifest (Test-ModuleManifest, the module’s exports) or the bytes and layout of the files of a module.
PSDSCReturnCorrectTypesForDSCFunctions - deferred Needs the DSC resource model (resource classes and the standard Get/Set/Test functions across a module).
PSDSCStandardDSCFunctionsInResource - deferred Needs the DSC resource model (resource classes and the standard Get/Set/Test functions across a module).
PSDSCUseIdenticalMandatoryParametersForDSC - deferred Needs the DSC resource model (resource classes and the standard Get/Set/Test functions across a module).
PSDSCUseIdenticalParametersForDSC - deferred Needs the DSC resource model (resource classes and the standard Get/Set/Test functions across a module).
PSDSCUseVerboseMessageInDSCResource - deferred Needs the DSC resource model (resource classes and the standard Get/Set/Test functions across a module).
PSUseUsingScopeModifierInNewRunspaces - deferred Needs a scope pass over variables (assignments, reads, nested script blocks, dot-sourcing).
PSUseConstrainedLanguageMode - deferred Needs the language mode analysis of the constrained language mode (the allowed types and commands).
PSAvoidUsingDoubleQuotesForConstantString - deferred Syntax only; not built yet.
PSAvoidSemicolonsAsLineTerminators - deferred Syntax only; not built yet.
PSAvoidExclaimOperator - deferred Syntax only; not built yet.
PSAvoidMultipleTypeAttributes - deferred Syntax only; not built yet.
PSAvoidNullOrEmptyHelpMessageAttribute - deferred Syntax only; not built yet.
PSAvoidReservedWordsAsFunctionNames - deferred Syntax only; not built yet.
PSUseSingleValueFromPipelineParameter - deferred Syntax only; not built yet.
PSAvoidGlobalAliases - deferred Syntax only; not built yet.
PSAvoidGlobalFunctions - deferred Syntax only; not built yet.
PSAvoidInvokingEmptyMembers - deferred Syntax only; not built yet.
PSAvoidShouldContinueWithoutForce - deferred Syntax only; not built yet.
PSAvoidUsingUsernameAndPasswordParams - deferred Syntax only; not built yet.
PSAvoidUsingComputerNameHardcoded - deferred Syntax only; not built yet.
PSAvoidUsingBrokenHashAlgorithms - deferred Syntax only; not built yet.
PSAvoidUsingAllowUnencryptedAuthentication - deferred Syntax only; not built yet.
PSAvoidDefaultValueForMandatoryParameter - deferred Syntax only; not built yet.
PSPossibleIncorrectUsageOfAssignmentOperator - deferred Syntax only; not built yet.
PSPossibleIncorrectUsageOfRedirectionOperator - deferred Syntax only; not built yet.
PSReservedCmdletChar - deferred Syntax only; not built yet.
PSReservedParams - deferred Syntax only; not built yet.
PSUseLiteralInitializerForHashtable - deferred Syntax only; not built yet.
PSUseConsistentParametersKind - deferred Syntax only; not built yet.
PSUseConsistentParameterSetName - deferred Syntax only; not built yet.
PSProvideCommentHelp - deferred Syntax only; not built yet.
PSUsePSCredentialType - deferred Syntax only; not built yet.
PSUseSupportsShouldProcess - deferred Syntax only; not built yet.