You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PowerShellForGitHub: Improve and Standardise WhatIf/Confirm Processing (#254)
Improves and standardizes the WhatIf/Confirm ('ShouldProcess') processing across all the functions.
* Moved the `$PSCmdlet.ShouldProcess` check out of `Invoke-GHRestMethod` and added it to the calling functions with the correct operation and target.
* Added `WhatIf:$false` and `Confirm:$false` to the `Out-File` Cmdlet call in the `Write-Log` function in the Helpers module. This will prevent the `Write-Log` function displaying `WhatIf` and `Confirm` prompts.
* Removed `ShouldProcess` from non-state changing functions.
* Modified the current `ShouldProcess` conditions to use an early return.
* Modified the `Set-GitHubIssueLabel` function to remove `ConfirmImpact='High'` and set `ConfirmPreference` to 'Low' if no labels have been specified instead.
* Modified the `Update-GitHubRepository` function to remove `ConfirmImpact='High'` and set `ConfirmPreference` to 'Low' if the repo is being renamed instead.
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
40
+
[CmdletBinding(DefaultParameterSetName='Weekly')]
44
41
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter","", Justification="DateType due to PowerShell/PSScriptAnalyzer#1472")]
45
42
param
46
43
(
@@ -165,10 +162,7 @@ function Group-GitHubPullRequest
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
165
+
[CmdletBinding(DefaultParameterSetName='Weekly')]
172
166
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter","", Justification="DateType due to PowerShell/PSScriptAnalyzer#1472")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
72
69
[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.")]
73
70
param(
74
71
[Parameter(ParameterSetName='Elements')]
@@ -188,11 +185,8 @@ filter Test-GitHubAssignee
188
185
Checks if a user has permission to be assigned to an issue
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
196
190
[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.")]
197
191
param(
198
192
[Parameter(ParameterSetName='Elements')]
@@ -348,7 +342,6 @@ function Add-GitHubAssignee
348
342
DefaultParameterSetName='Elements')]
349
343
[OutputType({$script:GitHubIssueTypeName})]
350
344
[Alias('New-GitHubAssignee')] # Non-standard usage of the New verb, but done to avoid a breaking change post 0.14.0
351
-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
352
345
[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.")]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
105
102
[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.")]
0 commit comments