Skip to content

Instantly share code, notes, and snippets.

@Halkcyon
Last active September 11, 2018 04:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Halkcyon/2ac58aad828e3178118071a86e5cba33 to your computer and use it in GitHub Desktop.
Save Halkcyon/2ac58aad828e3178118071a86e5cba33 to your computer and use it in GitHub Desktop.
# PSScriptAnalyzerSettings.psd1
# v1.17.1
@{
# This key overrides `Enable` in the `Rules` key
# 'ExcludeRules' = @('PSAvoidUsingWriteHost')
# This was not including all rules so I manually defined them in the `Rules` key
# 'IncludeRules' = @('*')
# CustomRulePath did not allow processing any other rules without this key enabled
'IncludeDefaultRules' = $true
# This can be relative to the `.psd1` file
'CustomRulePath' = @('CustomRule.psm1')
# I want to see all violations
'Severity' = @('Error', 'Warning', 'Information')
'Rules' = @{
'PSAvoidUsingCmdletAliases' = @{
'Enable' = $true
'Whitelist' = @('%', '?')
}
'PSPlaceCloseBrace' = @{
'Enable' = $true
'NoEmptyLineBeforeBlock' = $true
'NewLineAfter' = $true
'IgnoreOneLineBlock' = $false
}
'PSPlaceOpenBrace' = @{
'Enable' = $true
'NewLineAfter' = $true
'OnSameLine' = $false
'IgnoreOneLineBlock' = $false
}
'PSProvideCommentHelp' = @{
'Enable' = $true
'ExportedOnly' = $true
'BlockComment' = $true
'VSCodeSnippetCorrection' = $false
'Placement' = 'begin'
}
'PSUseCompatibleCmdlets' = @{
'Enable' = $true
'compatibility' = @('desktop-5.1.14393.206-windows')
}
'PSUseConsistentIndentation' = @{
'Enable' = $true
'IndentationSize' = 4
'Kind' = 'space'
}
'PSUseConsistentWhitespace' = @{
'Enable' = $true
'CheckOpenBrace' = $true
'CheckOpenParen' = $true
'CheckSeparator' = $true
# caused weird issues with AlignAssignmentStatement evaluation
'CheckOperator' = $false
}
'PSAlignAssignmentStatement' = @{ 'Enable' = $true }
'PSAvoidAssignmentToAutomaticVariable' = @{ 'Enable' = $true }
'PSAvoidDefaultValueForMandatoryParameter' = @{ 'Enable' = $true }
'PSAvoidDefaultValueSwitchParameter' = @{ 'Enable' = $true }
'PSAvoidGlobalAliases' = @{ 'Enable' = $true }
'PSAvoidGlobalFunctions' = @{ 'Enable' = $true }
'PSAvoidGlobalVars' = @{ 'Enable' = $true }
'PSAvoidInvokingEmptyMembers' = @{ 'Enable' = $true }
'PSAvoidNullOrEmptyHelpMessageAttribute' = @{ 'Enable' = $true }
'PSAvoidShouldContinueWithoutForce' = @{ 'Enable' = $true }
'PSAvoidTrailingWhitespace' = @{ 'Enable' = $true }
'PSAvoidUsingComputerNameHardcoded' = @{ 'Enable' = $true }
'PSAvoidUsingConvertToSecureStringWithPlainText' = @{ 'Enable' = $true }
'PSAvoidUsingDeprecatedManifestFields' = @{ 'Enable' = $true }
'PSAvoidUsingEmptyCatchBlock' = @{ 'Enable' = $true }
'PSAvoidUsingInvokeExpression' = @{ 'Enable' = $true }
'PSAvoidUsingPlainTextForPassword' = @{ 'Enable' = $true }
'PSAvoidUsingPositionalParameters' = @{ 'Enable' = $true }
'PSAvoidUsingUserNameAndPassWordParams' = @{ 'Enable' = $true }
'PSAvoidUsingWMICmdlet' = @{ 'Enable' = $true }
'PSAvoidUsingWriteHost' = @{ 'Enable' = $true }
'PSDSCDscExamplesPresent' = @{ 'Enable' = $true }
'PSDSCDscTestsPresent' = @{ 'Enable' = $true }
'PSDSCReturnCorrectTypesForDSCFunctions' = @{ 'Enable' = $true }
'PSDSCStandardDSCFunctionsInResource' = @{ 'Enable' = $true }
'PSDSCUseIdenticalMandatoryParametersForDSC' = @{ 'Enable' = $true }
'PSDSCUseIdenticalParametersForDSC' = @{ 'Enable' = $true }
'PSDSCUseVerboseMessageInDSCResource' = @{ 'Enable' = $true }
'PSMisleadingBacktick' = @{ 'Enable' = $true }
'PSMissingModuleManifestField' = @{ 'Enable' = $true }
'PSPossibleIncorrectComparisonWithNull' = @{ 'Enable' = $true }
'PSPossibleIncorrectUsageOfAssignmentOperator' = @{ 'Enable' = $true }
'PSPossibleIncorrectUsageOfRedirectionOperator' = @{ 'Enable' = $true }
'PSReservedCmdletChar' = @{ 'Enable' = $true }
'PSReservedParams' = @{ 'Enable' = $true }
'PSShouldProcess' = @{ 'Enable' = $true }
'PSUseApprovedVerbs' = @{ 'Enable' = $true }
'PSUseBOMForUnicodeEncodedFile' = @{ 'Enable' = $true }
'PSUseCmdletCorrectly' = @{ 'Enable' = $true }
'PSUseDeclaredVarsMoreThanAssignments' = @{ 'Enable' = $true }
'PSUseLiteralInitializerForHashtable' = @{ 'Enable' = $true }
'PSUseOutputTypeCorrectly' = @{ 'Enable' = $true }
'PSUsePSCredentialType' = @{ 'Enable' = $true }
'PSUseShouldProcessForStateChangingFunctions' = @{ 'Enable' = $true }
'PSUseSingularNouns' = @{ 'Enable' = $true }
'PSUseSupportsShouldProcess' = @{ 'Enable' = $true }
'PSUseToExportFieldsInManifest' = @{ 'Enable' = $true }
'PSUseUTF8EncodingForHelpFile' = @{ 'Enable' = $true }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment