Skip to content

[Freshness] PSScriptAnalyzer Article Updates - Batch 1#401

Open
Xelu86 wants to merge 5 commits into
MicrosoftDocs:mainfrom
Xelu86:AvoidBatch1
Open

[Freshness] PSScriptAnalyzer Article Updates - Batch 1#401
Xelu86 wants to merge 5 commits into
MicrosoftDocs:mainfrom
Xelu86:AvoidBatch1

Conversation

@Xelu86
Copy link
Copy Markdown
Contributor

@Xelu86 Xelu86 commented May 28, 2026

PR Summary

These updates target the following PSScriptAnalyzer articles:

  • AvoidExclaimOperator
  • AvoidGlobalAliases
  • AvoidGlobalFunctions
  • AvoidGlobalVars
  • AvoidInvokingEmptyMembers

Fixes AB#581953
Fixes AB#581954
Fixes AB#581955
Fixes AB#582601
Fixes AB#582602

PR Checklist

  • Descriptive Title: This PR's title is a synopsis of the changes it proposes.
  • Summary: This PR's summary describes the scope and intent of the change.
  • Contributor's Guide: I have read the contributors guide.
  • Style: This PR adheres to the style guide.

@learn-build-service-prod
Copy link
Copy Markdown

PoliCheck Scan Report

The 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 found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod
Copy link
Copy Markdown

Learn Build status updates of commit b954d39:

✅ Validation status: passed

File Status Preview URL Details
reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidExclaimOperator.md ✅Succeeded View (ps-modules)
reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidGlobalAliases.md ✅Succeeded View (ps-modules)
reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidGlobalFunctions.md ✅Succeeded View (ps-modules)
reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidGlobalVars.md ✅Succeeded View (ps-modules)
reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidInvokingEmptyMembers.md ✅Succeeded View (ps-modules)
reference/docs-conceptual/toc.yml ✅Succeeded View (ps-modules)

For more details, please refer to the build report.

@learn-build-service-prod
Copy link
Copy Markdown

PoliCheck Scan Report

The 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 found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod
Copy link
Copy Markdown

Learn Build status updates of commit 3bf93ae:

✅ Validation status: passed

File Status Preview URL Details
reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidExclaimOperator.md ✅Succeeded View (ps-modules)
reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidGlobalAliases.md ✅Succeeded View (ps-modules)
reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidGlobalFunctions.md ✅Succeeded View (ps-modules)
reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidGlobalVars.md ✅Succeeded View (ps-modules)
reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidInvokingEmptyMembers.md ✅Succeeded View (ps-modules)
reference/docs-conceptual/toc.yml ✅Succeeded View (ps-modules)

For more details, please refer to the build report.

@Xelu86 Xelu86 marked this pull request as ready for review June 1, 2026 13:58
Copilot AI review requested due to automatic review settings June 1, 2026 13:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 AvoidExclaimOperator to 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_Scopes and 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.

Comment thread reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidGlobalFunctions.md Outdated
@learn-build-service-prod
Copy link
Copy Markdown

PoliCheck Scan Report

The 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 found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod
Copy link
Copy Markdown

Learn Build status updates of commit 80dfe51:

✅ Validation status: passed

File Status Preview URL Details
reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidExclaimOperator.md ✅Succeeded View (ps-modules)
reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidGlobalAliases.md ✅Succeeded View (ps-modules)
reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidGlobalFunctions.md ✅Succeeded View (ps-modules)
reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidGlobalVars.md ✅Succeeded View (ps-modules)
reference/docs-conceptual/PSScriptAnalyzer/Rules/AvoidInvokingEmptyMembers.md ✅Succeeded View (ps-modules)
reference/docs-conceptual/toc.yml ✅Succeeded View (ps-modules)

For more details, please refer to the build report.

@Xelu86
Copy link
Copy Markdown
Contributor Author

Xelu86 commented Jun 1, 2026

@michaeltlombardi, please review when able.

Copy link
Copy Markdown
Contributor

@michaeltlombardi michaeltlombardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor suggestions but overall LGTM! Once these are addressed I'll approve and merge.

Comment on lines +13 to +14
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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Comment on lines +48 to +56
## 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`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +13 to +14
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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommend updating this to use the same construction as AvoidGlobalFUnctions which reads more clearly to me:

Suggested change
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.

Comment on lines +19 to +20
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].
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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].

Comment on lines +23 to +24
Use local or script scope for variables instead of global scope. To learn more, see
[about_Scopes][01].
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants