[Freshness] PSScriptAnalyzer Article Updates - Batch 1#401
Conversation
PoliCheck Scan ReportThe following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans. ✅ No issues foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
|
Learn Build status updates of commit b954d39: ✅ Validation status: passed
For more details, please refer to the build report. |
PoliCheck Scan ReportThe following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans. ✅ No issues foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
|
Learn Build status updates of commit 3bf93ae: ✅ Validation status: passed
For more details, please refer to the build report. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates PSScriptAnalyzer rule reference documentation and adds the new AvoidExclaimOperator rule page to the conceptual docs TOC.
Changes:
- Added
AvoidExclaimOperatorto the conceptual TOC and introduced a new rule reference page. - Refined wording and examples across several existing rule reference pages.
- Added link references to
about_Scopesand modernized headings/terminology (Noncompliant/Compliant).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| reference/docs-conceptual/toc.yml | Adds the new rule doc to the TOC so it appears in navigation. |
| reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidInvokingEmptyMembers.md | Updates description text and renames example headings. |
| reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidGlobalVars.md | Updates guidance and adds a link reference to about_Scopes. |
| reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidGlobalFunctions.md | Clarifies rationale and adds about_Scopes link reference. |
| reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidGlobalAliases.md | Clarifies rationale and adds about_Scopes link reference. |
| reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidExclaimOperator.md | Adds/updates rule documentation, configuration, and parameters sections. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PoliCheck Scan ReportThe following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans. ✅ No issues foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
|
Learn Build status updates of commit 80dfe51: ✅ Validation status: passed
For more details, please refer to the build report. |
|
@michaeltlombardi, please review when able. |
michaeltlombardi
left a comment
There was a problem hiding this comment.
Minor suggestions but overall LGTM! Once these are addressed I'll approve and merge.
| This rule detects the use of the negation operator exclamation mark (`!`) and recommends using the | ||
| `-not` operator instead for improved readability and consistency with PowerShell conventions. |
There was a problem hiding this comment.
| This rule detects the use of the negation operator exclamation mark (`!`) and recommends using the | |
| `-not` operator instead for improved readability and consistency with PowerShell conventions. | |
| This rule detects the use of the negation operator (an exclamation mark, `!`) and recommends using | |
| the `-not` operator instead for improved readability and consistency with PowerShell conventions. |
| ## Parameters | ||
|
|
||
| ### Enable | ||
|
|
||
| Enables (`$true`) the rule during ScriptAnalyzer invocation. | ||
|
|
||
| - `Enable`: **bool** (Default value is `$false`) | ||
| ### Disable | ||
|
|
||
| Enable or disable the rule during ScriptAnalyzer invocation. | ||
| Disables (`$false`) the rule during ScriptAnalyzer invocation. Default value is `$false`. |
There was a problem hiding this comment.
On reflection, and checking 396, which Sean reviewed and merged, this construction does seem a little strange.
Do we have a template for the new document structure to use for rules?
This construction implies that I can set either PSAvoidExclaimOperator.Enable or PSAvoidExclaimOperator.Disable, which seems inaccurate.
The previous construction shows a single configurable option (Enable) that defaults to $false and can be set to $true to enable the rule.
| Global aliases can override existing aliases in the current session. This override | ||
| creates naming conflicts that lead to hard to diagnose problems for module and script consumers. |
There was a problem hiding this comment.
Recommend updating this to use the same construction as AvoidGlobalFUnctions which reads more clearly to me:
| Global aliases can override existing aliases in the current session. This override | |
| creates naming conflicts that lead to hard to diagnose problems for module and script consumers. | |
| Global aliases can unintentionally override existing aliases in the session, leading to unexpected | |
| behavior and name collisions. Name collisions make it difficult for module consumers to diagnose | |
| issues and maintain code reliability. |
| Instead of using the Global scope, use other scope modifiers such as `Local` or `Process` when | ||
| creating new aliases. To learn more, see [about_Scopes][01]. |
There was a problem hiding this comment.
| Instead of using the Global scope, use other scope modifiers such as `Local` or `Process` when | |
| creating new aliases. To learn more, see [about_Scopes][01]. | |
| To avoid this issue, define aliases without the **Scope** parameter, or use other appropriate scope | |
| modifiers. To learn more, see [about_Scopes][01]. |
| Use local or script scope for variables instead of global scope. To learn more, see | ||
| [about_Scopes][01]. |
There was a problem hiding this comment.
| Use local or script scope for variables instead of global scope. To learn more, see | |
| [about_Scopes][01]. | |
| Use local or script scope for variables instead of the global scope. To learn more, see | |
| [about_Scopes][01]. |
PR Summary
These updates target the following PSScriptAnalyzer articles:
AvoidExclaimOperatorAvoidGlobalAliasesAvoidGlobalFunctionsAvoidGlobalVarsAvoidInvokingEmptyMembersFixes AB#581953
Fixes AB#581954
Fixes AB#581955
Fixes AB#582601
Fixes AB#582602
PR Checklist