There was an error while loading. Please reload this page.
1 parent f288303 commit d84b024Copy full SHA for d84b024
6 files changed
PSScriptAnalyzerSettings.psd1
@@ -1,4 +1,26 @@
1
@{
2
- IncludeRules=@('PSProvideCommentHelp',
3
- 'PSAvoidUsingWriteHost')
+ IncludeRules=@('PSUseApprovedVerbs',
+ 'PSReservedCmdletChar',
4
+ 'PSReservedParams',
5
+ 'PSShouldProcess',
6
+ 'PSUseShouldProcessForStateChangingFunctions',
7
+ 'PSUseSingularNouns',
8
+ 'PSMissingModuleManifestField',
9
+ 'PSAvoidDefaultValueSwitchParameter',
10
+ 'PSAvoidUsingCmdletAliases',
11
+ 'PSAvoidUsingWMICmdlet',
12
+ 'PSAvoidUsingEmptyCatchBlock',
13
+ 'PSUseCmdletCorrectly',
14
15
+ 'PSAvoidUsingPositionalParameters',
16
+ 'PSAvoidGlobalVars',
17
+ 'PSUseDeclaredVarsMoreThanAssignments',
18
+ 'PSAvoidUsingInvokeExpression',
19
+ 'PSAvoidUsingPlainTextForPassword',
20
+ 'PSAvoidUsingComputerNameHardcoded',
21
+ 'PSAvoidUsingConvertToSecureStringWithPlainText',
22
+ 'PSUsePSCredentialType',
23
+ 'PSAvoidUsingUserNameAndPasswordParams',
24
+ 'PSDSC*'
25
+ )
26
}
src/private/Convert-ArrayToRegex.ps1
@@ -19,7 +19,7 @@ function Convert-ArrayToRegex {
'^(' + ($Items -join '|') + ')$'
else {
- '^(' + (($Items | %{[regex]::Escape($_)}) -join '|') + ')$'
+ '^(' + (($Items | ForEach-Object{[regex]::Escape($_)}) -join '|') + ')$'
src/private/Get-BuildFilePath.ps1
@@ -1,3 +1,3 @@
function Get-BuildFilePath {
- $BuildPath = (Get-ChildItem -File -Filter "*.buildenvironment.json" -Path '.\','..\','.\build\' -ErrorAction:SilentlyContinue | select -First 1).FullName
+ $BuildPath = (Get-ChildItem -File -Filter "*.buildenvironment.json" -Path '.\','..\','.\build\' -ErrorAction:SilentlyContinue | Select-Object -First 1).FullName
src/private/Get-FunctionParameter.ps1
@@ -78,7 +78,7 @@ function Get-FunctionParameter {
78
$functions = $CodeBlock | Get-Function -Name $Name
79
if (-not $IncludeEmbedded) {
80
Write-Verbose "$($FunctionName): Not including embedded functions."
81
- $functions = $functions | where {-not $_.IsEmbedded}
+ $functions = $functions | Where-Object {-not $_.IsEmbedded}
82
83
84
Foreach ($f in $functions) {
@@ -93,7 +93,7 @@ function Get-FunctionParameter {
93
'ParameterType' = $ParamType[0].typeName.FullName
94
95
# This will add in any other parameter attributes if they are specified (default attributes are thus not included and output may not be normalized)
96
- $p.FindAll($paramattributes, $true) | Foreach {
+ $p.FindAll($paramattributes, $true) | ForEach-Object {
97
$OutProps.($_.ArgumentName) = $_.Argument.Value
98
99
$Output += New-Object -TypeName PSObject -Property $OutProps
@@ -114,7 +114,7 @@ function Get-FunctionParameter {
114
115
116
117
118
119
120
src/private/New-CommentBasedHelp.ps1
@@ -78,9 +78,9 @@
$OutCBH = @{}
$OutCBH.FunctionName = $f
[string]$OutParams = ''
- $fparams = @($AllParams | Where {$_.FunctionName -eq $f} | Sort-Object -Property Position)
+ $fparams = @($AllParams | Where-Object {$_.FunctionName -eq $f} | Sort-Object -Property Position)
if ($fparams.count -gt 0) {
- $fparams | foreach {
+ $fparams | ForEach-Object {
$ParamHelpMessage = if ([string]::IsNullOrEmpty($_.HelpMessage)) { $_.ParameterName + " explanation`n`r`n`r"} else {$_.HelpMessage + "`n`r`n`r"}
85
86
$OutParams += $CBH_PARAM -replace '%%PARAM%%',$_.ParameterName -replace '%%PARAMHELP%%',$ParamHelpMessage
src/public/Add-PublicFunction.ps1
@@ -66,7 +66,7 @@ function Add-PublicFunction {
66
$PublicFunctionSrc = Join-Path $BuildEnvPath $BuildEnvInfo.PublicFunctionSource
67
$TemplatePath = Join-Path $BuildEnvPath $BuildEnvInfo.FunctionTemplates
68
$TemplateLookup = @{}
69
- Get-ChildItem -Path $TemplatePath -Filter '*.tem' | Foreach {
+ Get-ChildItem -Path $TemplatePath -Filter '*.tem' | ForEach-Object {
70
$TemplateLookup.($_.BaseName) = $_.FullName
71
72
$BuildEnvVars = (Get-Member -Type 'NoteProperty' -InputObject $LoadedBuildEnv).Name
@@ -101,7 +101,7 @@ function Add-PublicFunction {
101
$NewFunctionOutput = $TemplateData -replace '%%FunctionName%%', $FunctionName
102
103
# Next replace any other variables found in our build environment file that exist in the template.
104
- $BuildEnvVars | Foreach {
+ $BuildEnvVars | ForEach-Object {
105
Write-Verbose " Replacing %%$($_)%% with $($BuildEnvInfo.$_) if found in template..."
106
$NewFunctionOutput = $NewFunctionOutput -replace "%%$($_)%%", ($BuildEnvInfo.$_ -join ',')
107
0 commit comments