PR Watcher and Manual Validation update.
- [ ] Have you signed the Contributor License Agreement?
- [ ] Have you checked that there aren't other open pull requests for the same manifest update/change?
- [ ] This PR only modifies one (1) manifest
- [ ] Have you validated your manifest locally with
winget validate --manifest <path>? - [ ] Have you tested your manifest locally with
winget install --manifest <path>? - [ ] Does your manifest conform to the 1.5 schema?
Note: <path> is the name of the directory containing the manifest you're submitting.
Microsoft Reviewers: Open in CodeFlow
Also some analyzer warnings in your other scripts -
Mostly around -
- Write-Host
- These can probably be suprressed with
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Justification = 'This script is not intended to have any outputs piped')]
- These can probably be suprressed with
- Variables defined but never used
- Functions which modify state not supporting
ShouldProcess - Approved Verbs
- These can probably be suppressed, but may want to check them anyways
- Use Singular nouns
- These can probably be suppressed, but may want to check them anyways
- Empty catch blocks
- Whitespace at end of line
- Incorrect null comparison (
$nullshould always be on the left side of equality comparisons) - Cmdlet aliases
PS D:\Git\winget-pkgs> Invoke-ScriptAnalyzer D:\Git\winget-pkgs\Tools\ManualValidationProfile.ps1
RuleName Severity ScriptName Line Message
-------- -------- ---------- ---- -------
PSUseDeclaredVarsMoreThanAssignment Warning ManualVali 15 The variable 'SharedFolder' is assigned but never used.
s dationProf
ile.ps1
PSUseShouldProcessForStateChangingF Warning ManualVali 31 Function 'Set-Status' has verb that could change system
unctions dationProf state. Therefore, the function has to support
ile.ps1 'ShouldProcess'.
PSUseShouldProcessForStateChangingF Warning ManualVali 65 Function 'Update-Stuff' has verb that could change system
unctions dationProf state. Therefore, the function has to support
ile.ps1 'ShouldProcess'.
PSUseApprovedVerbs Warning ManualVali 41 The cmdlet 'Run-Validation' uses an unapproved verb.
dationProf
ile.ps1
PSAvoidUsingWriteHost Warning ManualVali 6 File 'ManualValidationProfile.ps1' uses Write-Host. Avoid
dationProf using Write-Host because it might not work in all hosts,
ile.ps1 does not work when there is no host, and (prior to PS 5.0)
cannot be suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning ManualVali 27 File 'ManualValidationProfile.ps1' uses Write-Host. Avoid
dationProf using Write-Host because it might not work in all hosts,
ile.ps1 does not work when there is no host, and (prior to PS 5.0)
cannot be suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning ManualVali 36 File 'ManualValidationProfile.ps1' uses Write-Host. Avoid
dationProf using Write-Host because it might not work in all hosts,
ile.ps1 does not work when there is no host, and (prior to PS 5.0)
cannot be suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PS D:\Git\winget-pkgs> Invoke-ScriptAnalyzer D:\Git\winget-pkgs\Tools\PRWatcher.ps1
RuleName Severity ScriptName Line Message
-------- -------- ---------- ---- -------
PSAvoidUsingCmdletAliases Warning PRWatcher. 58 'where' is an alias of 'Where-Object'. Alias can introduce
ps1 possible problems and make scripts hard to maintain. Please
consider changing alias to its full content.
PSAvoidUsingCmdletAliases Warning PRWatcher. 1225 'where' is an alias of 'Where-Object'. Alias can introduce
ps1 possible problems and make scripts hard to maintain. Please
consider changing alias to its full content.
PSAvoidUsingCmdletAliases Warning PRWatcher. 1279 'where' is an alias of 'Where-Object'. Alias can introduce
ps1 possible problems and make scripts hard to maintain. Please
consider changing alias to its full content.
PSAvoidUsingCmdletAliases Warning PRWatcher. 1312 'where' is an alias of 'Where-Object'. Alias can introduce
ps1 possible problems and make scripts hard to maintain. Please
consider changing alias to its full content.
PSAvoidUsingCmdletAliases Warning PRWatcher. 1492 '%' is an alias of 'ForEach-Object'. Alias can introduce
ps1 possible problems and make scripts hard to maintain. Please
consider changing alias to its full content.
PSAvoidUsingCmdletAliases Warning PRWatcher. 1493 '%' is an alias of 'ForEach-Object'. Alias can introduce
ps1 possible problems and make scripts hard to maintain. Please
consider changing alias to its full content.
PSAvoidUsingCmdletAliases Warning PRWatcher. 1507 'iwr' is an alias of 'Invoke-WebRequest'. Alias can
ps1 introduce possible problems and make scripts hard to
maintain. Please consider changing alias to its full
content.
PSUseDeclaredVarsMoreThanAssignment Warning PRWatcher. 14 The variable 'appName' is assigned but never used.
s ps1
PSUseDeclaredVarsMoreThanAssignment Warning PRWatcher. 289 The variable 'nvalidColor' is assigned but never used.
s ps1
PSUseDeclaredVarsMoreThanAssignment Warning PRWatcher. 1285 The variable 'matchVar' is assigned but never used.
s ps1
PSUseDeclaredVarsMoreThanAssignment Warning PRWatcher. 1465 The variable 'i' is assigned but never used.
s ps1
PSPossibleIncorrectComparisonWithNu Warning PRWatcher. 1233 $null should be on the left side of equality comparisons.
ll ps1
PSPossibleIncorrectComparisonWithNu Warning PRWatcher. 1248 $null should be on the left side of equality comparisons.
ll ps1
PSUseBOMForUnicodeEncodedFile Warning PRWatcher. Missing BOM encoding for non-ASCII encoded file
ps1 'PRWatcher.ps1'
PSUseShouldProcessForStateChangingF Warning PRWatcher. 1513 Function 'Set-PadRight' has verb that could change system
unctions ps1 state. Therefore, the function has to support
'ShouldProcess'.
PSUseApprovedVerbs Warning PRWatcher. 1484 The cmdlet 'Create-Sandbox' uses an unapproved verb.
ps1
PSUseApprovedVerbs Warning PRWatcher. 1499 The cmdlet 'Check-ForManifestEntries' uses an unapproved
ps1 verb.
PSUseSingularNouns Warning PRWatcher. 16 The cmdlet 'Watch-PRTitles' uses a plural noun. A singular
ps1 noun should be used instead.
PSUseSingularNouns Warning PRWatcher. 1499 The cmdlet 'Check-ForManifestEntries' uses a plural noun. A
ps1 singular noun should be used instead.
PSAvoidUsingWriteHost Warning PRWatcher. 33 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning PRWatcher. 35 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning PRWatcher. 37 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning PRWatcher. 41 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning PRWatcher. 43 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning PRWatcher. 45 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning PRWatcher. 46 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning PRWatcher. 47 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning PRWatcher. 83 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning PRWatcher. 1212 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning PRWatcher. 1276 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning PRWatcher. 1307 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning PRWatcher. 1318 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning PRWatcher. 1331 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning PRWatcher. 1355 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning PRWatcher. 1387 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning PRWatcher. 1429 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning PRWatcher. 1436 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning PRWatcher. 1437 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingWriteHost Warning PRWatcher. 1446 File 'PRWatcher.ps1' uses Write-Host. Avoid using
ps1 Write-Host because it might not work in all hosts, does not
work when there is no host, and (prior to PS 5.0) cannot be
suppressed, captured, or redirected. Instead, use
Write-Output, Write-Verbose, or Write-Information.
PSAvoidUsingEmptyCatchBlock Warning PRWatcher. 1385 Empty catch block is used. Please use Write-Error or throw
ps1 statements in catch blocks.
PSAvoidUsingEmptyCatchBlock Warning PRWatcher. 1509 Empty catch block is used. Please use Write-Error or throw
ps1 statements in catch blocks.
Avoid using Write-Host because it might not work in all hosts, does not work when there is no host, and (prior to PS 5.0) cannot be suppressed, captured, or redirected. Instead, use Write-Output, Write-Verbose, or Write-Information.
The problem with this error is that the alternatives are not equivalent. Write-Output has no option similar to Write-Host's -nonewline to suppress adding a newline at the end of output. This suggests that PowerShell shouldn't be used to write console applications such as these.
Avoid using Write-Host because it might not work in all hosts, does not work when there is no host, and (prior to PS 5.0) cannot be suppressed, captured, or redirected. Instead, use Write-Output, Write-Verbose, or Write-Information.
The problem with this error is that the alternatives are not equivalent. Write-Output has no option similar to Write-Host's
-nonewlineto suppress adding a newline at the end of output. This suggests that PowerShell shouldn't be used to write console applications such as these.
Precisely why I provided the snippet for suppressing the Write-Output item
For these,
Functions which modify state not supporting ShouldProcess Approved Verbs
To suppress the error I'm using the "antipattern of make everything start with Get-".
This one doesn't make sense to me - isn't null additive and commutative?
Incorrect null comparison ($null should always be on the left side of equality comparisons)
This one doesn't make sense to me - isn't null additive and commutative?
Incorrect null comparison ($null should always be on the left side of equality comparisons)
https://learn.microsoft.com/en-us/powershell/utility-modules/psscriptanalyzer/rules/possibleincorrectcomparisonwithnull?view=ps-modules
Precisely why I provided the snippet for suppressing the
Write-Outputitem
My local client doesn't enjoy the snippet:
PowerShell 7.4.0
Manual Validation build: 510
ParserError: C:\repos\winget-pkgs\Tools\PRWatcher.ps1:46
Line |
46 | [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWrite …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Unexpected attribute 'Diagnostics.CodeAnalysis.SuppressMessageAttribute'.
PS C:\ManVal>
Edit: it only errors if present in both files. Will validation need it in both, or will one be sufficient?
Precisely why I provided the snippet for suppressing the
Write-OutputitemMy local client doesn't enjoy the snippet:
PowerShell 7.4.0 Manual Validation build: 510 ParserError: C:\repos\winget-pkgs\Tools\PRWatcher.ps1:46 Line | 46 | [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWrite … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Unexpected attribute 'Diagnostics.CodeAnalysis.SuppressMessageAttribute'. PS C:\ManVal>Edit: it only errors if present in both files. Will validation need it in both, or will one be sufficient?
@stephengillie - Can you try the PR that I raised into your fork?
@ stephengillie - Can you try the PR that I raised into your fork?
I'm not sure how to do this. I don't see a PR in my tree. Am I looking in the wrong place?
@ stephengillie - Can you try the PR that I raised into your fork?
I'm not sure how to do this. I don't see a PR in my tree. Am I looking in the wrong place?
https://github.com/stephengillie/winget-pkgs/pulls
Looks like I have some merge conflicts now that I'll need to resolve
I updated these earlier today, but wanted to have a full round of validations and approvals to catch most of the errors.
@microsoft-github-policy-service agree company="Microsoft"