Skip to content

Commit 79fe37f

Browse files
bergmeisterJamesWTruher
authored andcommitted
Fix PSAvoidUsingCmdletAliases warnings in root and Utils folder using the new -Fix switch. Encoding was corrected to stay the same. (#872)
1 parent 3adb9df commit 79fe37f

5 files changed

+16
-16
lines changed

.build.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,20 @@ function CreateIfNotExists([string] $folderPath) {
3838
}
3939

4040
function Get-BuildInputs($project) {
41-
pushd $buildRoot/$project
42-
gci -Filter *.cs
43-
gci -Directory -Exclude obj, bin | gci -Filter *.cs -Recurse
44-
popd
41+
Push-Location $buildRoot/$project
42+
Get-ChildItem -Filter *.cs
43+
Get-ChildItem -Directory -Exclude obj, bin | Get-ChildItem -Filter *.cs -Recurse
44+
Pop-Location
4545
}
4646

4747
function Get-BuildOutputs($project) {
4848
$bin = "$buildRoot/$project/bin/$Configuration/$Framework"
4949
$obj = "$buildRoot/$project/obj/$Configuration/$Framework"
5050
if (Test-Path $bin) {
51-
gci $bin -Recurse
51+
Get-ChildItem $bin -Recurse
5252
}
5353
if (Test-Path $obj) {
54-
gci $obj -Recurse
54+
Get-ChildItem $obj -Recurse
5555
}
5656
}
5757

New-StronglyTypedCsFileForResx.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ internal class {0} {{
110110
}}
111111
}}
112112
'@
113-
$entries = $xml.root.data | % {
113+
$entries = $xml.root.data | ForEach-Object {
114114
if ($_) {
115115
$val = $_.value.Replace("`n", "`n ///")
116116
$name = $_.name.Replace(' ', '_')

Utils/New-CommandDataFile.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ $shortModuleInfos = Get-ChildItem -Path $builtinModulePath `
8282
$module = $_
8383
Write-Progress $module.Name
8484
$commands = Get-Command -Module $module
85-
$shortCommands = $commands | select -Property Name,@{Label='CommandType';Expression={$_.CommandType.ToString()}},ParameterSets
86-
$shortModuleInfo = $module | select -Property Name,@{Label='Version';Expression={$_.Version.ToString()}}
85+
$shortCommands = $commands | Select-Object -Property Name,@{Label='CommandType';Expression={$_.CommandType.ToString()}},ParameterSets
86+
$shortModuleInfo = $module | Select-Object -Property Name,@{Label='Version';Expression={$_.Version.ToString()}}
8787
Add-Member -InputObject $shortModuleInfo -NotePropertyName 'ExportedCommands' -NotePropertyValue $shortCommands
8888
Add-Member -InputObject $shortModuleInfo -NotePropertyName 'ExportedAliases' -NotePropertyValue $module.ExportedAliases.Keys -PassThru
8989
}
@@ -95,12 +95,12 @@ $shortModuleInfos = Get-ChildItem -Path $builtinModulePath `
9595
$psCoreSnapinName = 'Microsoft.PowerShell.Core'
9696
Write-Progress $psCoreSnapinName
9797
$commands = Get-Command -Module $psCoreSnapinName
98-
$shortCommands = $commands | select -Property Name,@{Label='CommandType';Expression={$_.CommandType.ToString()}},ParameterSets
98+
$shortCommands = $commands | Select-Object -Property Name,@{Label='CommandType';Expression={$_.CommandType.ToString()}},ParameterSets
9999
$shortModuleInfo = New-Object -TypeName PSObject -Property @{Name=$psCoreSnapinName; Version=$commands[0].PSSnapin.PSVersion.ToString()}
100100
Add-Member -InputObject $shortModuleInfo -NotePropertyName 'ExportedCommands' -NotePropertyValue $shortCommands
101101

102102
# Find the exported aliases for the commands in Microsoft.PowerShell.Core
103-
$aliases = Get-Alias * | where {($commands).Name -contains $_.ResolvedCommandName}
103+
$aliases = Get-Alias * | Where-Object { ($commands).Name -contains $_.ResolvedCommandName }
104104
if ($null -eq $aliases) {
105105
$aliases = @()
106106
}

Utils/ReleaseMaker.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function Get-VersionsFromChangeLog
8989
function New-ReleaseBuild
9090
{
9191
$solutionPath = Get-SolutionPath
92-
pushd $solutionPath
92+
Push-Location $solutionPath
9393
try
9494
{
9595
remove-item out/ -recurse -force
@@ -101,7 +101,7 @@ function New-ReleaseBuild
101101
}
102102
finally
103103
{
104-
popd
104+
Pop-Location
105105
}
106106
}
107107

Utils/RuleMaker.psm1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ Function Add-RuleStrings($Rule)
286286
Function Remove-RuleStrings($Rule)
287287
{
288288
$stringsXml = Get-RuleStrings $Rule
289-
$nodesToRemove = $stringsXml.root.GetElementsByTagName("data") | ? {$_.name -match $Rule.Name}
289+
$nodesToRemove = $stringsXml.root.GetElementsByTagName("data") | Where-Object { $_.name -match $Rule.Name }
290290
$nodesToRemove | Foreach-Object { $stringsXml.root.RemoveChild($_) }
291291
Set-RuleStrings $stringsXml
292292
}
@@ -307,7 +307,7 @@ Function Set-RuleProjectXml($projectXml)
307307

308308
Function Get-CompileTargetGroup($projectXml)
309309
{
310-
$projectXml.Project.ItemGroup | ? {$_.Compile -ne $null}
310+
$projectXml.Project.ItemGroup | Where-Object { $_.Compile -ne $null }
311311
}
312312

313313
Function Add-RuleToProject($Rule)
@@ -324,7 +324,7 @@ Function Remove-RuleFromProject($Rule)
324324
{
325325
$projectXml = Get-RuleProjectXml
326326
$compileItemgroup = Get-CompileTargetGroup $projectXml
327-
$itemToRemove = $compileItemgroup.Compile | ? {$_.Include -eq $Rule.SourceFileName}
327+
$itemToRemove = $compileItemgroup.Compile | Where-Object { $_.Include -eq $Rule.SourceFileName }
328328
$compileItemgroup.RemoveChild($itemToRemove)
329329
Set-RuleProjectXml $projectXml
330330
}

0 commit comments

Comments
 (0)