Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PSAvoidUsingCmdletAliases warnings of internal build/release scripts in root and Utils folder #872

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix PSAvoidUsingCmdletAliases warnings in root and Utils folder using…
… the new -Fix switch. Encoding was corrected to stay the same.
  • Loading branch information
bergmeister committed Feb 5, 2018
commit d7e00647c791686a7c4cabe8cc43de58892fd169
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