Add reason for AvoidGlobalVars#426
Conversation
|
Learn Build status updates of commit f854fcc: ✅ 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 |
There was a problem hiding this comment.
Pull request overview
This PR updates PSScriptAnalyzer documentation, primarily by expanding the rationale for the AvoidGlobalVars rule, and also by adjusting/modernizing several PowerShell code samples in related articles.
Changes:
- Adds explanatory rationale text and updates examples for
AvoidGlobalVars. - Normalizes formatting in
UseApprovedVerbsexample snippets. - Refactors and updates multiple guidance/sample-code sections in
create-custom-rule.md(including output type wording and example rule function).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| reference/docs-conceptual/PSScriptAnalyzer/Rules/UseApprovedVerbs.md | Formatting-only tweak to the PowerShell examples. |
| reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidGlobalVars.md | Adds rationale text and rewrites the compliant/noncompliant examples. |
| reference/docs-conceptual/PSScriptAnalyzer/create-custom-rule.md | Updates guidance wording and significantly revises sample code for custom rules. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $result = [Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticRecord[]]@{ | ||
| "Message" = "This is a sample rule" | ||
| "Extent" = $ast.Extent | ||
| "RuleName" = $PSCmdlet.MyInvocation.InvocationName | ||
| "Severity" = "Warning" | ||
| Message = 'This is a sample rule' | ||
| Extent = $ast.Extent | ||
| RuleName = $PSCmdlet.MyInvocation.InvocationName | ||
| Severity = 'Warning' |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Learn Build status updates of commit e1a0027: ❌ Validation status: errorsPlease follow instructions here which may help to resolve issue.
For more details, please refer to the build report. Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them. |
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 7cb011f: ✅ Validation status: passed
For more details, please refer to the build report. |
PR Summary
Add reason for AvoidGlobalVars
PR Checklist