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
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.
Copy file name to clipboardexpand all lines: GitHubAnalytics.ps1
+110-54
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,7 @@ function Group-GitHubIssue
37
37
SupportsShouldProcess,
38
38
DefaultParameterSetName='Weekly')]
39
39
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
40
+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter","", Justification="DateType due to PowerShell/PSScriptAnalyzer#1472")]
@@ -130,6 +158,7 @@ function Group-GitHubPullRequest
130
158
SupportsShouldProcess,
131
159
DefaultParameterSetName='Weekly')]
132
160
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
161
+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter","", Justification="DateType due to PowerShell/PSScriptAnalyzer#1472")]
133
162
param
134
163
(
135
164
[Parameter(
@@ -148,41 +177,68 @@ function Group-GitHubPullRequest
Copy file name to clipboardexpand all lines: GitHubAssignees.ps1
+4
Original file line number
Diff line number
Diff line change
@@ -41,6 +41,7 @@ function Get-GitHubAssignee
41
41
SupportsShouldProcess,
42
42
DefaultParameterSetName='Elements')]
43
43
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
44
+
[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.")]
44
45
param(
45
46
[Parameter(ParameterSetName='Elements')]
46
47
[string] $OwnerName,
@@ -128,6 +129,7 @@ function Test-GitHubAssignee
128
129
DefaultParameterSetName='Elements')]
129
130
[OutputType([bool])]
130
131
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
132
+
[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.")]
131
133
param(
132
134
[Parameter(ParameterSetName='Elements')]
133
135
[string] $OwnerName,
@@ -228,6 +230,7 @@ function New-GithubAssignee
228
230
SupportsShouldProcess,
229
231
DefaultParameterSetName='Elements')]
230
232
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
233
+
[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.")]
231
234
param(
232
235
[Parameter(ParameterSetName='Elements')]
233
236
[string] $OwnerName,
@@ -330,6 +333,7 @@ function Remove-GithubAssignee
330
333
SupportsShouldProcess,
331
334
DefaultParameterSetName='Elements')]
332
335
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
336
+
[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.")]
Copy file name to clipboardexpand all lines: GitHubBranches.ps1
+1
Original file line number
Diff line number
Diff line change
@@ -55,6 +55,7 @@ function Get-GitHubRepositoryBranch
55
55
SupportsShouldProcess,
56
56
DefaultParameterSetName='Elements')]
57
57
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
58
+
[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.")]
Copy file name to clipboardexpand all lines: GitHubComments.ps1
+3
Original file line number
Diff line number
Diff line change
@@ -244,6 +244,7 @@ function New-GitHubComment
244
244
SupportsShouldProcess,
245
245
DefaultParameterSetName='Elements')]
246
246
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
247
+
[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.")]
247
248
param(
248
249
[Parameter(ParameterSetName='Elements')]
249
250
[string] $OwnerName,
@@ -355,6 +356,7 @@ function Set-GitHubComment
355
356
SupportsShouldProcess,
356
357
DefaultParameterSetName='Elements')]
357
358
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
359
+
[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.")]
358
360
param(
359
361
[Parameter(ParameterSetName='Elements')]
360
362
[string] $OwnerName,
@@ -456,6 +458,7 @@ function Remove-GitHubComment
456
458
DefaultParameterSetName='Elements')]
457
459
[Alias('Delete-GitHubComment')]
458
460
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
461
+
[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.")]
Copy file name to clipboardexpand all lines: GitHubCore.ps1
+1
Original file line number
Diff line number
Diff line change
@@ -612,6 +612,7 @@ function Invoke-GHRestMethodMultipleResult
612
612
#>
613
613
[CmdletBinding(SupportsShouldProcess)]
614
614
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
615
+
[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.")]
Copy file name to clipboardexpand all lines: GitHubIssues.ps1
+2
Original file line number
Diff line number
Diff line change
@@ -378,6 +378,7 @@ function Get-GitHubIssueTimeline
378
378
SupportsShouldProcess,
379
379
DefaultParameterSetName='Elements')]
380
380
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
381
+
[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.")]
381
382
param(
382
383
[Parameter(ParameterSetName='Elements')]
383
384
[string] $OwnerName,
@@ -861,6 +862,7 @@ function Unlock-GitHubIssue
861
862
SupportsShouldProcess,
862
863
DefaultParameterSetName='Elements')]
863
864
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
865
+
[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.")]
Copy file name to clipboardexpand all lines: GitHubLabels.ps1
+5
Original file line number
Diff line number
Diff line change
@@ -206,6 +206,7 @@ function New-GitHubLabel
206
206
SupportsShouldProcess,
207
207
DefaultParameterSetName='Elements')]
208
208
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
209
+
[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.")]
209
210
param(
210
211
[Parameter(ParameterSetName='Elements')]
211
212
[string] $OwnerName,
@@ -320,6 +321,7 @@ function Remove-GitHubLabel
320
321
SupportsShouldProcess,
321
322
DefaultParameterSetName='Elements')]
322
323
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
324
+
[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.")]
323
325
[Alias('Delete-GitHubLabel')]
324
326
param(
325
327
[Parameter(ParameterSetName='Elements')]
@@ -551,6 +553,7 @@ function Set-GitHubLabel
551
553
SupportsShouldProcess,
552
554
DefaultParameterSetName='Elements')]
553
555
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
556
+
[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.")]
554
557
param(
555
558
[Parameter(ParameterSetName='Elements')]
556
559
[string] $OwnerName,
@@ -662,6 +665,7 @@ function Add-GitHubIssueLabel
662
665
SupportsShouldProcess,
663
666
DefaultParameterSetName='Elements')]
664
667
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
668
+
[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.")]
770
+
[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.")]
Copy file name to clipboardexpand all lines: GitHubMilestones.ps1
+1
Original file line number
Diff line number
Diff line change
@@ -506,6 +506,7 @@ function Remove-GitHubMilestone
506
506
DefaultParameterSetName='Elements')]
507
507
[Alias('Delete-GitHubMilestone')]
508
508
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess","", Justification="Methods called within here make use of PSShouldProcess, and the switch is passed on to them inherently.")]
509
+
[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