Skip to content

Instantly share code, notes, and snippets.

@falkheiland
Last active January 5, 2023 09:59
Show Gist options
  • Save falkheiland/e04ee71411821fbd7a9adec178a26a30 to your computer and use it in GitHub Desktop.
Save falkheiland/e04ee71411821fbd7a9adec178a26a30 to your computer and use it in GitHub Desktop.
<#
Use absolute Path for the setting to this file in vscode - vars do not work atm - 05.01.2023 vscode 1.74.2
"powershell.scriptAnalysis.settingsPath": "C:\\.vscode\\PSScriptAnalyzerSettings.psd1"
#>
# Use the PowerShell extension setting `powershell.scriptAnalysis.settingsPath` to get the current workspace
# to use this PSScriptAnalyzerSettings.psd1 file to configure code analysis in Visual Studio Code.
# This setting is configured in the workspace's `.vscode\settings.json`.
#
# For more information on PSScriptAnalyzer settings see:
# https://github.com/PowerShell/PSScriptAnalyzer/blob/master/README.md#settings-support-in-scriptanalyzer
#
# You can see the predefined PSScriptAnalyzer settings here:
# https://github.com/PowerShell/PSScriptAnalyzer/tree/master/Engine/Settings
# https://docs.microsoft.com/en-us/powershell/utility-modules/psscriptanalyzer/rules/readme?view=ps-modules
@{
# Only diagnostic records of the specified severity will be generated.
# Uncomment the following line if you only want Errors and Warnings but
# not Information diagnostic records.
#Severity = @('Error','Warning')
# Analyze **only** the following rules. Use IncludeRules when you want
# to invoke only a small subset of the default rules.
# IncludeRules = @(
# 'PSAvoidDefaultValueSwitchParameter',
# 'PSMisleadingBacktick',
# 'PSMissingModuleManifestField',
# 'PSReservedCmdletChar',
# 'PSReservedParams',
# 'PSShouldProcess',
# 'PSUseApprovedVerbs',
# 'PSAvoidUsingCmdletAliases',
# 'PSUseDeclaredVarsMoreThanAssignments'
# )
# Do not analyze the following rules. Use ExcludeRules when you have
# commented out the IncludeRules settings above and want to include all
# the default rules except for those you exclude below.
# Note: if a rule is in both IncludeRules and ExcludeRules, the rule
# will be excluded.
ExcludeRules = @(
'PSAvoidUsingWriteHost'
)
# You can use rule configuration to configure rules that support it:
Rules = @{
# PSAvoidUsingCmdletAliases = @{
# Whitelist = @("cd")
# }
PSAvoidLongLines = @{
Enable = $true
MaximumLineLength = 120
}
PSAvoidUsingDoubleQuotesForConstantString = @{
Enable = $true
}
PSPlaceOpenBrace = @{
Enable = $true
OnSameLine = $false
NewLineAfter = $true
IgnoreOneLineBlock = $true
}
PSPlaceCloseBrace = @{
Enable = $true
NoEmptyLineBefore = $false
IgnoreOneLineBlock = $true
NewLineAfter = $true
}
PSUseConsistentIndentation = @{
Enable = $true
IndentationSize = 2
PipelineIndentation = 'IncreaseIndentationForFirstPipeline '
Kind = 'space'
}
PSUseConsistentWhitespace = @{
Enable = $true
CheckInnerBrace = $true
CheckOpenBrace = $true
CheckOpenParen = $true
CheckOperator = $true
CheckPipe = $true
CheckPipeForRedundantWhitespace = $true
CheckSeparator = $true
CheckParameter = $true
IgnoreAssignmentOperatorInsideHashTable = $true
}
PSUseCorrectCasing = @{
Enable = $true
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment