Skip to content

Instantly share code, notes, and snippets.

@homotechsual
Last active September 29, 2022 15:14
Show Gist options
  • Save homotechsual/52c637f14adf2143148f76736e8afa9c to your computer and use it in GitHub Desktop.
Save homotechsual/52c637f14adf2143148f76736e8afa9c to your computer and use it in GitHub Desktop.
PSSA Settings
<#
.SYNOPSIS
Based on the PowerShell Script Analyzer (PSSA) presets.
.LINK
https://github.com/PowerShell/PSScriptAnalyzer/blob/master/Engine/Settings/
#>
@{
Severity = @(
'Error',
'Warning',
'Information'
)
IncludeRules = @(
'PSAlignAssignmentStatement',
'PSAvoidAssignmentToAutomaticVariable',
'PSAvoidDefaultValueForMandatoryParameter',
'PSAvoidDefaultValueSwitchParameter',
'PSAvoidGlobalAliases',
'PSAvoidGlobalVars',
'PSAvoidUsingCmdletAliases',
'PSAvoidUsingComputerNameHardcoded',
'PSAvoidUsingConvertToSecureStringWithPlainText',
'PSAvoidUsingDoubleQuotesForConstantString',
'PSAvoidUsingEmptyCatchBlock',
'PSAvoidUsingInvokeExpression',
'PSAvoidUsingPlainTextForPassword',
'PSAvoidUsingPositionalParameters',
'PSAvoidUsingUserNameAndPasswordParams',
'PSAvoidUsingWMICmdlet',
'PSAvoidUsingWriteHost',
'PSAvoidUsingWMICmdlet',
'PSDSC*',
'PSMissingModuleManifestField',
'PSPlaceCloseBrace',
'PSPlaceOpenBrace',
'PSProvideCommentHelp',
'PSReservedCmdletChar',
'PSReservedParams',
'PSShouldProcess',
'PSUseApprovedVerbs',
'PSUseCmdletCorrectly',
'PSUseConsistentIndentation',
'PSUseConsistentWhitespace',
'PSUseCorrectCasing',
'PSUseDeclaredVarsMoreThanAssignments',
'PSUsePSCredentialType',
'PSUseShouldProcessForStateChangingFunctions'
)
Rules = @{
PSPlaceOpenBrace = @{
Enable = $true
OnSameLine = $true
NewLineAfter = $true
IgnoreOneLineBlock = $true
}
PSPlaceCloseBrace = @{
Enable = $true
NewLineAfter = $false
IgnoreOneLineBlock = $true
NoEmptyLineBefore = $false
}
PSUseConsistentIndentation = @{
Enable = $true
Kind = 'space'
PipelineIndentation = 'IncreaseIndentationForFirstPipeline'
IndentationSize = 4
}
PSUseConsistentWhitespace = @{
Enable = $true
CheckInnerBrace = $true
CheckOpenBrace = $true
CheckOpenParen = $true
CheckOperator = $true
CheckPipe = $true
CheckPipeForRedundantWhitespace = $false
CheckSeparator = $true
CheckParameter = $false
IgnoreAssignmentOperatorInsideHashTable = $true
}
PSUseCorrectCasing = @{
Enable = $true
}
PSAvoidUsingDoubleQuotesForConstantString = @{
Enable = $true
}
PSAlignAssignmentStatement = @{
Enable = $false
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment