Skip to content

Commit 48afad9

Browse files
committed
Replace split method with split operator to handle null inputs
1 parent 869d9d2 commit 48afad9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/PSAppDeployToolkit.Tools/PSScriptAnalyzer/Measure-ADTCompatibility.psm1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<#
1+
<#
22
.SYNOPSIS
33
PSSCriptAnalyzer rules to check for usage of legacy PSAppDeployToolkit v3 commands or variables.
44
.DESCRIPTION
@@ -1876,8 +1876,8 @@ function Measure-ADTCompatibility
18761876
'AllowDeferCloseApps' = '-AllowDeferCloseProcesses' # Should inspect switch values here in case of -Switch:$false
18771877
'CloseApps' = {
18781878
$quoteChar = if ($boundParameters.CloseApps.Value.StringConstantType -eq 'DoubleQuoted') { '"' } else { "'" }
1879-
$closeProcesses = $boundParameters.CloseApps.Value.Value.Split(',').ForEach({
1880-
$name, $description = $_.Split('=')
1879+
$closeProcesses = $boundParameters.CloseApps.Value.Value -split ',' | & { process {
1880+
$name, $description = $_ -split '='
18811881
if ($description)
18821882
{
18831883
"@{ Name = $quoteChar$($name)$quoteChar; Description = $quoteChar$($description)$quoteChar }"
@@ -1886,7 +1886,7 @@ function Measure-ADTCompatibility
18861886
{
18871887
"$quoteChar$($name)$quoteChar"
18881888
}
1889-
}) -join ', '
1889+
}} -join ', '
18901890
"-CloseProcesses $closeProcesses"
18911891
}
18921892
}

0 commit comments

Comments
 (0)