Skip to content

Commit

Permalink
Fix PSAvoidUsingCmdletAliases warnings in root and Utils folder using…
Browse files Browse the repository at this point in the history
… the new -Fix switch. Encoding was corrected to stay the same. (#872)
  • Loading branch information
bergmeister authored and JamesWTruher committed Feb 6, 2018
1 parent 3adb9df commit 79fe37f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions .build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ function CreateIfNotExists([string] $folderPath) {
}

function Get-BuildInputs($project) {
pushd $buildRoot/$project
gci -Filter *.cs
gci -Directory -Exclude obj, bin | gci -Filter *.cs -Recurse
popd
Push-Location $buildRoot/$project
Get-ChildItem -Filter *.cs
Get-ChildItem -Directory -Exclude obj, bin | Get-ChildItem -Filter *.cs -Recurse
Pop-Location
}

function Get-BuildOutputs($project) {
$bin = "$buildRoot/$project/bin/$Configuration/$Framework"
$obj = "$buildRoot/$project/obj/$Configuration/$Framework"
if (Test-Path $bin) {
gci $bin -Recurse
Get-ChildItem $bin -Recurse
}
if (Test-Path $obj) {
gci $obj -Recurse
Get-ChildItem $obj -Recurse
}
}

Expand Down
2 changes: 1 addition & 1 deletion New-StronglyTypedCsFileForResx.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ internal class {0} {{
}}
}}
'@
$entries = $xml.root.data | % {
$entries = $xml.root.data | ForEach-Object {
if ($_) {
$val = $_.value.Replace("`n", "`n ///")
$name = $_.name.Replace(' ', '_')
Expand Down
8 changes: 4 additions & 4 deletions Utils/New-CommandDataFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ $shortModuleInfos = Get-ChildItem -Path $builtinModulePath `
$module = $_
Write-Progress $module.Name
$commands = Get-Command -Module $module
$shortCommands = $commands | select -Property Name,@{Label='CommandType';Expression={$_.CommandType.ToString()}},ParameterSets
$shortModuleInfo = $module | select -Property Name,@{Label='Version';Expression={$_.Version.ToString()}}
$shortCommands = $commands | Select-Object -Property Name,@{Label='CommandType';Expression={$_.CommandType.ToString()}},ParameterSets
$shortModuleInfo = $module | Select-Object -Property Name,@{Label='Version';Expression={$_.Version.ToString()}}
Add-Member -InputObject $shortModuleInfo -NotePropertyName 'ExportedCommands' -NotePropertyValue $shortCommands
Add-Member -InputObject $shortModuleInfo -NotePropertyName 'ExportedAliases' -NotePropertyValue $module.ExportedAliases.Keys -PassThru
}
Expand All @@ -95,12 +95,12 @@ $shortModuleInfos = Get-ChildItem -Path $builtinModulePath `
$psCoreSnapinName = 'Microsoft.PowerShell.Core'
Write-Progress $psCoreSnapinName
$commands = Get-Command -Module $psCoreSnapinName
$shortCommands = $commands | select -Property Name,@{Label='CommandType';Expression={$_.CommandType.ToString()}},ParameterSets
$shortCommands = $commands | Select-Object -Property Name,@{Label='CommandType';Expression={$_.CommandType.ToString()}},ParameterSets
$shortModuleInfo = New-Object -TypeName PSObject -Property @{Name=$psCoreSnapinName; Version=$commands[0].PSSnapin.PSVersion.ToString()}
Add-Member -InputObject $shortModuleInfo -NotePropertyName 'ExportedCommands' -NotePropertyValue $shortCommands

# Find the exported aliases for the commands in Microsoft.PowerShell.Core
$aliases = Get-Alias * | where {($commands).Name -contains $_.ResolvedCommandName}
$aliases = Get-Alias * | Where-Object { ($commands).Name -contains $_.ResolvedCommandName }
if ($null -eq $aliases) {
$aliases = @()
}
Expand Down
4 changes: 2 additions & 2 deletions Utils/ReleaseMaker.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function Get-VersionsFromChangeLog
function New-ReleaseBuild
{
$solutionPath = Get-SolutionPath
pushd $solutionPath
Push-Location $solutionPath
try
{
remove-item out/ -recurse -force
Expand All @@ -101,7 +101,7 @@ function New-ReleaseBuild
}
finally
{
popd
Pop-Location
}
}

Expand Down
6 changes: 3 additions & 3 deletions Utils/RuleMaker.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ Function Add-RuleStrings($Rule)
Function Remove-RuleStrings($Rule)
{
$stringsXml = Get-RuleStrings $Rule
$nodesToRemove = $stringsXml.root.GetElementsByTagName("data") | ? {$_.name -match $Rule.Name}
$nodesToRemove = $stringsXml.root.GetElementsByTagName("data") | Where-Object { $_.name -match $Rule.Name }
$nodesToRemove | Foreach-Object { $stringsXml.root.RemoveChild($_) }
Set-RuleStrings $stringsXml
}
Expand All @@ -307,7 +307,7 @@ Function Set-RuleProjectXml($projectXml)

Function Get-CompileTargetGroup($projectXml)
{
$projectXml.Project.ItemGroup | ? {$_.Compile -ne $null}
$projectXml.Project.ItemGroup | Where-Object { $_.Compile -ne $null }
}

Function Add-RuleToProject($Rule)
Expand All @@ -324,7 +324,7 @@ Function Remove-RuleFromProject($Rule)
{
$projectXml = Get-RuleProjectXml
$compileItemgroup = Get-CompileTargetGroup $projectXml
$itemToRemove = $compileItemgroup.Compile | ? {$_.Include -eq $Rule.SourceFileName}
$itemToRemove = $compileItemgroup.Compile | Where-Object { $_.Include -eq $Rule.SourceFileName }
$compileItemgroup.RemoveChild($itemToRemove)
Set-RuleProjectXml $projectXml
}
Expand Down

0 comments on commit 79fe37f

Please sign in to comment.