Get PSScriptAnalyzer clean again (#180)

Somehow a number of PSScriptAnalyzer issues snuck in.  This fixes them.

The main PSScriptAnalyzer issues needing to be fixed were:
 * `PSReviewUnusedParameter` - This one came up a lot due to our heavy
    usage of `Resolve-RepositoryElements` and `Resolve-ParameterWithDefaultConfigurationValue`
    which both end up referencing their parameters by grabbing them off
    the stack.  That means that `NoStatus` and `Uri` are frequently
    never directly referenced.  So, exceptions were added.  There were
    two cases (in GitHubAnalytics) where there was a false positive due
    to PowerShell/PSScriptAnalyzer#1472

 * `PSUseProcessBlockForPipelineCommand` - We had a number of functions
   that took pipeline input, but didn't actuall use the `process` block.
   This actually caught a bug with `Group-GitHubIssue` and
   `Group-GitHubPullRequest`.  Added correct `process` block usage for
   most of the functions, but removed pipeline support for those where
   it didn't actually make sense anymore.

 * `PSUseDeclaredVarsMoreThanAssignments` - These are false positives
   in the Pester tests due to the usage of `BeforeAll`.  There wasn't
   an obvious way to use `SuppressMessageAttribute` in the Pester test,
   so I used a hacky workaround to "use" the variable in the `BeforeAll`
   block.  I could have added the suppression to the top of the file,
   but I still want to catch real issues in those files later.

 * `PSAvoidOverwritingBuiltInCmdlets` - It turns out that there's a bug
   with PSDesiredStateConfiguration in PS Core 6.1.0 where it was exporting
   internal functions.  This was thus a false-postive flag for Write-Log.
   See PowerShell/PowerShell#7209 for more info.

Also, it turns out that `Group-GitHubPullRequest` hadn't actually been
exported, so I fixed that too.
This commit is contained in:
Howard Wolosky 2020-05-26 08:01:17 -07:00 коммит произвёл GitHub
Родитель 93689d69ee
Коммит b7e1ea1cb9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
24 изменённых файлов: 331 добавлений и 129 удалений

Просмотреть файл

@ -37,6 +37,7 @@ function Group-GitHubIssue
SupportsShouldProcess,
DefaultParameterSetName='Weekly')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="DateType due to PowerShell/PSScriptAnalyzer#1472")]
param
(
[Parameter(
@ -55,41 +56,68 @@ function Group-GitHubIssue
[string] $DateType = 'Created'
)
Write-InvocationLog
if ($PSCmdlet.ParameterSetName -eq 'Weekly')
begin
{
$totalIssues = 0
$weekDates = Get-WeekDate -Weeks $Weeks
$endOfWeek = Get-Date
Write-InvocationLog
foreach ($week in $weekDates)
if ($PSCmdlet.ParameterSetName -eq 'Weekly')
{
$filteredIssues = @($Issue | Where-Object {
(($DateType -eq 'Created') -and ($_.created_at -ge $week) -and ($_.created_at -le $endOfWeek)) -or
(($DateType -eq 'Closed') -and ($_.closed_at -ge $week) -and ($_.closed_at -le $endOfWeek))
})
$weekDates = Get-WeekDate -Weeks $Weeks
$endOfWeek = $week
$count = $filteredIssues.Count
$totalIssues += $count
$result = [ordered]@{}
foreach ($week in $weekDates)
{
$result[$week] = ([PSCustomObject]([ordered]@{
'WeekStart' = $week
'Count' = 0
'Issues' = @()
}))
}
Write-Output -InputObject ([PSCustomObject]([ordered]@{
'WeekStart' = $week
'Count' = $count
'Issues' = $filteredIssues
$result['total'] = ([PSCustomObject]([ordered]@{
'WeekStart' = 'total'
'Count' = 0
'Issues' = @()
}))
}
Write-Output -InputObject ([PSCustomObject]([ordered]@{
'WeekStart' = 'total'
'Count' = $totalIssues
'Issues' = $Issue
}))
}
else
process
{
Write-Output -InputObject $Issue
if ($PSCmdlet.ParameterSetName -eq 'Weekly')
{
$endOfWeek = Get-Date
foreach ($week in $weekDates)
{
$filteredIssues = @($Issue | Where-Object {
(($DateType -eq 'Created') -and ($_.created_at -ge $week) -and ($_.created_at -le $endOfWeek)) -or
(($DateType -eq 'Closed') -and ($_.closed_at -ge $week) -and ($_.closed_at -le $endOfWeek))
})
$endOfWeek = $week
$result[$week].Issues += $filteredIssues
$result[$week].Count += ($filteredIssues.Count)
$result['total'].Issues += $filteredIssues
$result['total'].Count += ($filteredIssues.Count)
}
}
else
{
Write-Output -InputObject $Issue
}
}
end
{
if ($PSCmdlet.ParameterSetName -eq 'Weekly')
{
foreach ($entry in $result.Values.GetEnumerator())
{
Write-Output -InputObject $entry
}
}
}
}
@ -130,6 +158,7 @@ function Group-GitHubPullRequest
SupportsShouldProcess,
DefaultParameterSetName='Weekly')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="DateType due to PowerShell/PSScriptAnalyzer#1472")]
param
(
[Parameter(
@ -148,41 +177,68 @@ function Group-GitHubPullRequest
[string] $DateType = 'Created'
)
Write-InvocationLog
if ($PSCmdlet.ParameterSetName -eq 'Weekly')
begin
{
$totalPullRequests = 0
$weekDates = Get-WeekDate -Weeks $Weeks
$endOfWeek = Get-Date
Write-InvocationLog
foreach ($week in $weekDates)
if ($PSCmdlet.ParameterSetName -eq 'Weekly')
{
$filteredPullRequests = @($PullRequest | Where-Object {
(($DateType -eq 'Created') -and ($_.created_at -ge $week) -and ($_.created_at -le $endOfWeek)) -or
(($DateType -eq 'Merged') -and ($_.merged_at -ge $week) -and ($_.merged_at -le $endOfWeek))
})
$weekDates = Get-WeekDate -Weeks $Weeks
$endOfWeek = $week
$count = $filteredPullRequests.Count
$totalPullRequests += $count
$result = [ordered]@{}
foreach ($week in $weekDates)
{
$result[$week] = ([PSCustomObject]([ordered]@{
'WeekStart' = $week
'Count' = 0
'PullRequests' = @()
}))
}
Write-Output -InputObject ([PSCustomObject]([ordered]@{
'WeekStart' = $week
'Count' = $count
'PullRequests' = $filteredPullRequests
$result['total'] = ([PSCustomObject]([ordered]@{
'WeekStart' = 'total'
'Count' = 0
'PullRequests' = @()
}))
}
Write-Output -InputObject ([PSCustomObject]([ordered]@{
'WeekStart' = 'total'
'Count' = $totalPullRequests
'PullRequests' = $PullRequest
}))
}
else
process
{
Write-Output -InputObject $PullRequest
if ($PSCmdlet.ParameterSetName -eq 'Weekly')
{
$endOfWeek = Get-Date
foreach ($week in $weekDates)
{
$filteredPullRequests = @($PullRequest | Where-Object {
(($DateType -eq 'Created') -and ($_.created_at -ge $week) -and ($_.created_at -le $endOfWeek)) -or
(($DateType -eq 'Merged') -and ($_.merged_at -ge $week) -and ($_.merged_at -le $endOfWeek))
})
$endOfWeek = $week
$result[$week].PullRequests += $filteredPullRequests
$result[$week].Count += ($filteredPullRequests.Count)
$result['total'].PullRequests += $filteredPullRequests
$result['total'].Count += ($filteredPullRequests.Count)
}
}
else
{
Write-Output -InputObject $PullRequest
}
}
end
{
if ($PSCmdlet.ParameterSetName -eq 'Weekly')
{
foreach ($entry in $result.Values.GetEnumerator())
{
Write-Output -InputObject $entry
}
}
}
}

Просмотреть файл

@ -41,6 +41,7 @@ function Get-GitHubAssignee
SupportsShouldProcess,
DefaultParameterSetName='Elements')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(ParameterSetName='Elements')]
[string] $OwnerName,
@ -128,6 +129,7 @@ function Test-GitHubAssignee
DefaultParameterSetName='Elements')]
[OutputType([bool])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(ParameterSetName='Elements')]
[string] $OwnerName,
@ -228,6 +230,7 @@ function New-GithubAssignee
SupportsShouldProcess,
DefaultParameterSetName='Elements')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(ParameterSetName='Elements')]
[string] $OwnerName,
@ -330,6 +333,7 @@ function Remove-GithubAssignee
SupportsShouldProcess,
DefaultParameterSetName='Elements')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(ParameterSetName='Elements')]
[string] $OwnerName,

Просмотреть файл

@ -55,6 +55,7 @@ function Get-GitHubRepositoryBranch
SupportsShouldProcess,
DefaultParameterSetName='Elements')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
[Alias('Get-GitHubBranch')]
param(
[Parameter(ParameterSetName='Elements')]

Просмотреть файл

@ -244,6 +244,7 @@ function New-GitHubComment
SupportsShouldProcess,
DefaultParameterSetName='Elements')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(ParameterSetName='Elements')]
[string] $OwnerName,
@ -355,6 +356,7 @@ function Set-GitHubComment
SupportsShouldProcess,
DefaultParameterSetName='Elements')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(ParameterSetName='Elements')]
[string] $OwnerName,
@ -456,6 +458,7 @@ function Remove-GitHubComment
DefaultParameterSetName='Elements')]
[Alias('Delete-GitHubComment')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(ParameterSetName='Elements')]
[string] $OwnerName,

Просмотреть файл

@ -612,6 +612,7 @@ function Invoke-GHRestMethodMultipleResult
#>
[CmdletBinding(SupportsShouldProcess)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
[OutputType([Object[]])]
param(
[Parameter(Mandatory)]

Просмотреть файл

@ -378,6 +378,7 @@ function Get-GitHubIssueTimeline
SupportsShouldProcess,
DefaultParameterSetName='Elements')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(ParameterSetName='Elements')]
[string] $OwnerName,
@ -861,6 +862,7 @@ function Unlock-GitHubIssue
SupportsShouldProcess,
DefaultParameterSetName='Elements')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(ParameterSetName='Elements')]
[string] $OwnerName,

Просмотреть файл

@ -206,6 +206,7 @@ function New-GitHubLabel
SupportsShouldProcess,
DefaultParameterSetName='Elements')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(ParameterSetName='Elements')]
[string] $OwnerName,
@ -320,6 +321,7 @@ function Remove-GitHubLabel
SupportsShouldProcess,
DefaultParameterSetName='Elements')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
[Alias('Delete-GitHubLabel')]
param(
[Parameter(ParameterSetName='Elements')]
@ -551,6 +553,7 @@ function Set-GitHubLabel
SupportsShouldProcess,
DefaultParameterSetName='Elements')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(ParameterSetName='Elements')]
[string] $OwnerName,
@ -662,6 +665,7 @@ function Add-GitHubIssueLabel
SupportsShouldProcess,
DefaultParameterSetName='Elements')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(Mandatory, ParameterSetName='Elements')]
[string] $OwnerName,
@ -763,6 +767,7 @@ function Set-GitHubIssueLabel
SupportsShouldProcess,
DefaultParameterSetName='Elements')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(ParameterSetName='Elements')]
[string] $OwnerName,

Просмотреть файл

@ -506,6 +506,7 @@ function Remove-GitHubMilestone
DefaultParameterSetName='Elements')]
[Alias('Delete-GitHubMilestone')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(Mandatory, ParameterSetName='Elements')]
[string] $OwnerName,

Просмотреть файл

@ -53,6 +53,7 @@ function Get-GitHubRateLimit
#>
[CmdletBinding(SupportsShouldProcess)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[string] $AccessToken,
@ -119,6 +120,7 @@ function ConvertFrom-GitHubMarkdown
#>
[CmdletBinding(SupportsShouldProcess)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(
Mandatory,
@ -137,36 +139,42 @@ function ConvertFrom-GitHubMarkdown
[switch] $NoStatus
)
Write-InvocationLog
begin
{
Write-InvocationLog
$telemetryProperties = @{
'Mode' = $Mode
$telemetryProperties = @{
'Mode' = $Mode
}
$modeConverter = @{
'Markdown' = 'markdown'
'GitHubFlavoredMarkdown' = 'gfm'
}
}
$modeConverter = @{
'Markdown' = 'markdown'
'GitHubFlavoredMarkdown' = 'gfm'
process
{
$hashBody = @{
'text' = $Content
'mode' = $modeConverter[$Mode]
}
if (-not [String]::IsNullOrEmpty($Context)) { $hashBody['context'] = $Context }
$params = @{
'UriFragment' = 'markdown'
'Body' = (ConvertTo-Json -InputObject $hashBody)
'Method' = 'Post'
'Description' = "Converting Markdown to HTML"
'AccessToken' = $AccessToken
'TelemetryEventName' = $MyInvocation.MyCommand.Name
'TelemetryProperties' = $telemetryProperties
'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -Name NoStatus -ConfigValueName DefaultNoStatus)
}
Write-Output -InputObject (Invoke-GHRestMethod @params)
}
$hashBody = @{
'text' = $Content
'mode' = $modeConverter[$Mode]
}
if (-not [String]::IsNullOrEmpty($Context)) { $hashBody['context'] = $Context }
$params = @{
'UriFragment' = 'markdown'
'Body' = (ConvertTo-Json -InputObject $hashBody)
'Method' = 'Post'
'Description' = "Converting Markdown to HTML"
'AccessToken' = $AccessToken
'TelemetryEventName' = $MyInvocation.MyCommand.Name
'TelemetryProperties' = $telemetryProperties
'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -Name NoStatus -ConfigValueName DefaultNoStatus)
}
return Invoke-GHRestMethod @params
}
function Get-GitHubLicense
@ -318,6 +326,7 @@ function Get-GitHubEmoji
#>
[CmdletBinding(SupportsShouldProcess)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[string] $AccessToken,

Просмотреть файл

@ -32,6 +32,7 @@ function Get-GitHubOrganizationMember
Get-GitHubOrganizationMember -OrganizationName PowerShell
#>
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
[CmdletBinding(SupportsShouldProcess)]
param
(
@ -96,6 +97,7 @@ function Test-GitHubOrganizationMember
Test-GitHubOrganizationMember -OrganizationName PowerShell -UserName Octocat
#>
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
[CmdletBinding(SupportsShouldProcess)]
[OutputType([bool])]
param

Просмотреть файл

@ -166,8 +166,8 @@ function New-GitHubProjectCard
SupportsShouldProcess,
DefaultParameterSetName = 'Note')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification = "Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(Mandatory)]
[int64] $Column,
@ -371,6 +371,7 @@ function Remove-GitHubProjectCard
ConfirmImpact = 'High')]
[Alias('Delete-GitHubProjectCard')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification = "Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(Mandatory)]
[int64] $Card,

Просмотреть файл

@ -39,6 +39,7 @@ function Get-GitHubProjectColumn
SupportsShouldProcess,
DefaultParameterSetName = 'Project')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification = "Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(Mandatory, ParameterSetName = 'Project')]
[int64] $Project,
@ -118,6 +119,7 @@ function New-GitHubProjectColumn
[CmdletBinding(
SupportsShouldProcess)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification = "Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(Mandatory)]
@ -190,6 +192,7 @@ function Set-GitHubProjectColumn
[CmdletBinding(
SupportsShouldProcess)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification = "Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(Mandatory)]
[int64] $Column,
@ -264,6 +267,7 @@ function Remove-GitHubProjectColumn
ConfirmImpact = 'High')]
[Alias('Delete-GitHubProjectColumn')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification = "Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(Mandatory)]
[int64] $Column,
@ -346,6 +350,7 @@ function Move-GitHubProjectColumn
[CmdletBinding(
SupportsShouldProcess)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification = "Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(Mandatory)]
[int64] $Column,

Просмотреть файл

@ -477,6 +477,7 @@ function Remove-GitHubProject
ConfirmImpact = 'High')]
[Alias('Delete-GitHubProject')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification = "Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(Mandatory)]
[int64] $Project,

Просмотреть файл

@ -47,6 +47,7 @@ function Get-GitHubRepositoryFork
SupportsShouldProcess,
DefaultParameterSetName='Elements')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(ParameterSetName='Elements')]
[string] $OwnerName,

Просмотреть файл

@ -44,6 +44,7 @@ function Get-GitHubReferrerTraffic
SupportsShouldProcess,
DefaultParameterSetName='Elements')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(ParameterSetName='Elements')]
[string] $OwnerName,
@ -128,6 +129,7 @@ function Get-GitHubPathTraffic
SupportsShouldProcess,
DefaultParameterSetName='Elements')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(ParameterSetName='Elements')]
[string] $OwnerName,
@ -216,6 +218,7 @@ function Get-GitHubViewTraffic
SupportsShouldProcess,
DefaultParameterSetName='Elements')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(ParameterSetName='Elements')]
[string] $OwnerName,
@ -308,6 +311,7 @@ function Get-GitHubCloneTraffic
SupportsShouldProcess,
DefaultParameterSetName='Elements')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(ParameterSetName='Elements')]
[string] $OwnerName,

Просмотреть файл

@ -48,6 +48,7 @@ function Get-GitHubTeam
Get-GitHubTeam -OrganizationName PowerShell
#>
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
[CmdletBinding(
SupportsShouldProcess,
DefaultParameterSetName='Elements')]

Просмотреть файл

@ -57,6 +57,7 @@ function Get-GitHubUser
SupportsShouldProcess,
DefaultParameterSetName='ListAndSearch')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(ParameterSetName='ListAndSearch')]
[string] $User,
@ -129,6 +130,7 @@ function Get-GitHubUserContextualInformation
#>
[CmdletBinding(SupportsShouldProcess)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="One or more parameters (like NoStatus) are only referenced by helper methods which get access to it from the stack via Get-Variable -Scope 1.")]
param(
[Parameter(Mandatory)]
[string] $User,

Просмотреть файл

@ -262,6 +262,7 @@ function Write-Log
[CmdletBinding(SupportsShouldProcess)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidGlobalVars", "", Justification="We need to be able to access the PID for logging purposes, and it is accessed via a global variable.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidOverwritingBuiltInCmdlets", "", Justification="Write-Log is an internal function being incorrectly exported by PSDesiredStateConfiguration. See PowerShell/PowerShell#7209")]
param(
[Parameter(ValueFromPipeline)]
[AllowEmptyCollection()]
@ -618,19 +619,27 @@ function Write-InteractiveHost
[System.ConsoleColor] $BackgroundColor
)
# Determine if the host is interactive
if ([Environment]::UserInteractive -and `
![Bool]([Environment]::GetCommandLineArgs() -like '-noni*') -and `
(Get-Host).Name -ne 'Default Host')
begin
{
# Special handling for OutBuffer (generated for the proxy function)
$outBuffer = $null
if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer))
{
$PSBoundParameters['OutBuffer'] = 1
}
$hostIsInteractive = ([Environment]::UserInteractive -and
![Bool]([Environment]::GetCommandLineArgs() -like '-noni*') -and
((Get-Host).Name -ne 'Default Host'))
}
Write-Host @PSBoundParameters
process
{
# Determine if the host is interactive
if ($hostIsInteractive)
{
# Special handling for OutBuffer (generated for the proxy function)
$outBuffer = $null
if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer))
{
$PSBoundParameters['OutBuffer'] = 1
}
Write-Host @PSBoundParameters
}
}
}
@ -679,15 +688,18 @@ function Resolve-UnverifiedPath
[string] $Path
)
$resolvedPath = Resolve-Path -Path $Path -ErrorVariable resolvePathError -ErrorAction SilentlyContinue
process
{
$resolvedPath = Resolve-Path -Path $Path -ErrorVariable resolvePathError -ErrorAction SilentlyContinue
if ($null -eq $resolvedPath)
{
return $resolvePathError[0].TargetObject
}
else
{
return $resolvedPath.ProviderPath
if ($null -eq $resolvedPath)
{
Write-Output -InputObject ($resolvePathError[0].TargetObject)
}
else
{
Write-Output -InputObject ($resolvedPath.ProviderPath)
}
}
}

Просмотреть файл

@ -82,9 +82,7 @@ function Get-NugetPackage
#>
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(
Mandatory,
ValueFromPipeline)]
[Parameter(Mandatory)]
[string] $PackageName,
[Parameter(Mandatory)]

Просмотреть файл

@ -92,6 +92,7 @@
'Get-GitHubUserContextualInformation',
'Get-GitHubViewTraffic',
'Group-GitHubIssue',
'Group-GitHubPullRequest',
'Invoke-GHRestMethod',
'Invoke-GHRestMethodMultipleResult',
'Lock-GitHubIssue',

Просмотреть файл

@ -41,7 +41,12 @@ try
$card = New-GitHubProjectCard -Column $column.id -Note $defaultCard
$cardArchived = New-GitHubProjectCard -Column $column.id -Note $defaultArchivedCard
$null = Set-GitHubProjectCard -Card $cardArchived.id -Archive
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$card = $card
$cardArchived = $cardArchived
}
AfterAll {
$null = Remove-GitHubProjectCard -Card $card.id -Confirm:$false
}
@ -85,7 +90,13 @@ try
$card = New-GitHubProjectCard -Column $column.id -Note $defaultCard
$cardTwo = New-GitHubProjectCard -Column $column.id -Note $defaultCardTwo
$cardArchived = New-GitHubProjectCard -Column $column.id -Note $defaultArchivedCard
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$card = $card
$cardTwo = $cardTwo
$cardArchived = $cardArchived
}
AfterAll {
$null = Remove-GitHubProjectCard -Card $card.id -Confirm:$false
}
@ -167,7 +178,11 @@ try
Context 'Create project card with note' {
BeforeAll {
$card = @{id = 0}
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$card = $card
}
AfterAll {
$null = Remove-GitHubProjectCard -Card $card.id -Confirm:$false
Remove-Variable -Name card
@ -188,7 +203,11 @@ try
Context 'Create project card from issue' {
BeforeAll {
$card = @{id = 0}
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$card = $card
}
AfterAll {
$null = Remove-GitHubProjectCard -Card $card.id -Confirm:$false
Remove-Variable -Name card
@ -211,6 +230,9 @@ try
Context 'Remove card' {
BeforeAll {
$card = New-GitHubProjectCard -Column $column.id -Note $defaultCard
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$card = $card
}
$null = Remove-GitHubProjectCard -Card $card.id -Confirm:$false

Просмотреть файл

@ -27,7 +27,11 @@ try
Describe 'Getting Project Columns' {
BeforeAll {
$column = New-GitHubProjectColumn -Project $project.id -Name $defaultColumn
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$column = $column
}
AfterAll {
$null = Remove-GitHubProjectColumn -Column $column.id -Confirm:$false
}
@ -48,7 +52,12 @@ try
BeforeAll {
$column = New-GitHubProjectColumn -Project $project.id -Name $defaultColumn
$columntwo = New-GitHubProjectColumn -Project $project.id -Name $defaultColumnTwo
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$column = $column
$columnTwo = $columnTwo
}
AfterAll {
$null = Remove-GitHubProjectColumn -Column $column.id -Confirm:$false
$null = Remove-GitHubProjectColumn -Column $columntwo.id -Confirm:$false
@ -96,7 +105,11 @@ try
Context 'Create project column' {
BeforeAll {
$column = @{id = 0}
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$column = $column
}
AfterAll {
$null = Remove-GitHubProjectColumn -Column $column.id -Confirm:$false
Remove-Variable -Name column
@ -119,6 +132,9 @@ try
Context 'Remove project column' {
BeforeAll {
$column = New-GitHubProjectColumn -Project $project.id -Name $defaultColumn
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$column = $column
}
$null = Remove-GitHubProjectColumn -Column $column.id -Confirm:$false

Просмотреть файл

@ -35,11 +35,14 @@ try
$repo = New-GitHubRepository -RepositoryName ([Guid]::NewGuid().Guid) -AutoInit
Describe 'Getting Project' {
Context 'Get User projects' {
BeforeAll {
$project = New-GitHubProject -UserProject -Name $defaultUserProject -Description $defaultUserProjectDesc
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$project = $project
}
AfterAll {
$null = Remove-GitHubProject -Project $project.id -Confirm:$false
}
@ -61,7 +64,11 @@ try
Context 'Get Organization projects' {
BeforeAll {
$project = New-GitHubProject -OrganizationName $script:organizationName -Name $defaultOrgProject -Description $defaultOrgProjectDesc
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$project = $project
}
AfterAll {
$null = Remove-GitHubProject -Project $project.id -Confirm:$false
}
@ -83,7 +90,11 @@ try
Context 'Get Repo projects' {
BeforeAll {
$project = New-GitHubProject -OwnerName $script:ownerName -RepositoryName $repo.name -Name $defaultRepoProject -Description $defaultRepoProjectDesc
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$project = $project
}
AfterAll {
$null = Remove-GitHubProject -Project $project.id -Confirm:$false
}
@ -106,7 +117,11 @@ try
BeforeAll {
$project = New-GitHubProject -OwnerName $script:ownerName -RepositoryName $repo.name -Name $defaultProjectClosed -Description $defaultProjectClosedDesc
$null = Set-GitHubProject -Project $project.id -State Closed
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$project = $project
}
AfterAll {
$null = Remove-GitHubProject -Project $project.id -Confirm:$false
}
@ -134,7 +149,11 @@ try
Context 'Modify User projects' {
BeforeAll {
$project = New-GitHubProject -UserProject -Name $defaultUserProject -Description $defaultUserProjectDesc
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$project = $project
}
AfterAll {
$null = Remove-GitHubProject -Project $project.id -Confirm:$false
}
@ -157,7 +176,11 @@ try
Context 'Modify Organization projects' {
BeforeAll {
$project = New-GitHubProject -OrganizationName $script:organizationName -Name $defaultOrgProject -Description $defaultOrgProjectDesc
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$project = $project
}
AfterAll {
$null = Remove-GitHubProject -Project $project.id -Confirm:$false
}
@ -189,7 +212,11 @@ try
Context 'Modify Repo projects' {
BeforeAll {
$project = New-GitHubProject -OwnerName $script:ownerName -RepositoryName $repo.name -Name $defaultRepoProject -Description $defaultRepoProjectDesc
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$project = $project
}
AfterAll {
$null = Remove-GitHubProject -Project $project.id -Confirm:$false
}
@ -214,7 +241,11 @@ try
Context 'Create User projects' {
BeforeAll {
$project = @{id = 0}
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$project = $project
}
AfterAll {
$null = Remove-GitHubProject -Project $project.id -Confirm:$false
Remove-Variable project
@ -238,7 +269,11 @@ try
Context 'Create Organization projects' {
BeforeAll {
$project = @{id = 0}
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$project = $project
}
AfterAll {
$null = Remove-GitHubProject -Project $project.id -Confirm:$false
Remove-Variable project
@ -262,7 +297,11 @@ try
Context 'Create Repo projects' {
BeforeAll {
$project = @{id = 0}
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$project = $project
}
AfterAll {
$null = Remove-GitHubProject -Project $project.id -Confirm:$false
Remove-Variable project
@ -288,6 +327,9 @@ try
Context 'Remove User projects' {
BeforeAll {
$project = New-GitHubProject -UserProject -Name $defaultUserProject -Description $defaultUserProjectDesc
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$project = $project
}
$null = Remove-GitHubProject -Project $project.id -Confirm:$false
@ -299,6 +341,9 @@ try
Context 'Remove Organization projects' {
BeforeAll {
$project = New-GitHubProject -OrganizationName $script:organizationName -Name $defaultOrgProject -Description $defaultOrgProjectDesc
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$project = $project
}
$null = Remove-GitHubProject -Project $project.id -Confirm:$false
@ -310,6 +355,9 @@ try
Context 'Remove Repo projects' {
BeforeAll {
$project = New-GitHubProject -OwnerName $script:ownerName -RepositoryName $repo.name -Name $defaultRepoProject -Description $defaultRepoProjectDesc
# Avoid PSScriptAnalyzer PSUseDeclaredVarsMoreThanAssignments
$project = $project
}
$null = Remove-GitHubProject -Project $project.id -Confirm:$false

Просмотреть файл

@ -154,21 +154,24 @@ function Get-HashtableFromModuleManifest
[System.IO.FileInfo] $Path
)
try
process
{
$content = Get-Content -Path $Path -Encoding UTF8 -Raw
$scriptBlock = [scriptblock]::Create($content)
try
{
$content = Get-Content -Path $Path -Encoding UTF8 -Raw
$scriptBlock = [scriptblock]::Create($content)
[string[]] $allowedCommands = @()
[string[]] $allowedVariables = @()
$allowEnvronmentVariables = $false
$scriptBlock.CheckRestrictedLanguage($allowedCommands, $allowedVariables, $allowEnvronmentVariables)
[string[]] $allowedCommands = @()
[string[]] $allowedVariables = @()
$allowEnvronmentVariables = $false
$scriptBlock.CheckRestrictedLanguage($allowedCommands, $allowedVariables, $allowEnvronmentVariables)
return & $scriptBlock
}
catch
{
throw
Write-Output -InputObject (& $scriptBlock)
}
catch
{
throw
}
}
}
@ -183,7 +186,7 @@ function Get-FilesFromModuleManifest
The path to the .psd1 file for the module.
.OUTPUTS
[string[]] A list of full paths of all PowerShell files referenced by ModuleManifestPath.
[FileInfo[]] A list of full paths of all PowerShell files referenced by ModuleManifestPath.
#>
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingWriteHost", "", Justification = "This is the preferred way of writing output for Azure DevOps.")]
@ -195,23 +198,26 @@ function Get-FilesFromModuleManifest
[System.IO.FileInfo] $Path
)
Write-Host "$($scriptName): Getting list of PowerShell files referenced by [$Path]."
$manifest = Get-HashtableFromModuleManifest -Path $Path
$files = @($Path)
$moduleRoot = Split-Path -Path $Path -Parent
if (-not [String]::IsNullOrEmpty($manifest['RootModule']))
process
{
$files += Join-Path -Path $moduleRoot -ChildPath $manifest['RootModule']
}
Write-Host "$($scriptName): Getting list of PowerShell files referenced by [$Path]."
foreach ($file in $manifest['NestedModules'])
{
$files += Join-Path -Path $moduleRoot -ChildPath $file
}
$manifest = Get-HashtableFromModuleManifest -Path $Path
return $files
$files = @($Path)
$moduleRoot = Split-Path -Path $Path -Parent
if (-not [String]::IsNullOrEmpty($manifest['RootModule']))
{
$files += (Get-Item -Path (Join-Path -Path $moduleRoot -ChildPath $manifest['RootModule']))
}
foreach ($file in $manifest['NestedModules'])
{
$files += (Get-Item -Path (Join-Path -Path $moduleRoot -ChildPath $file))
}
Write-Output -InputObject $files
}
}
# Script body