-
Notifications
You must be signed in to change notification settings - Fork 55
Update freshness #373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update freshness #373
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,15 +1,15 @@ | ||||||
| --- | ||||||
| description: This article lists best-practice recommendations and the rules associated with them. | ||||||
| ms.date: 12/03/2024 | ||||||
| ms.date: 01/28/2026 | ||||||
| title: PSScriptAnalyzer rules and recommendations | ||||||
| --- | ||||||
| # PSScriptAnalyzer rules and recommendations | ||||||
|
|
||||||
| The following guidelines come from a combined effort from both the PowerShell team and the | ||||||
| community. The guidelines are organized by type. Within each type there is a list of rules. The | ||||||
| community. The guidelines are organized by type. Within each type, there's a list of rules. The | ||||||
| rules are grouped by the **Severity** defined in the implementation of the **PSScriptAnalyzer** | ||||||
| rule. The severity level labeled as 'TBD' means "To be determined". These are recommendations that | ||||||
| don't currently have rules defined. | ||||||
| rule. The severity level labeled `TBD` means "To be determined." Items labeled as TBD are | ||||||
| recommendations that don't currently have rules defined. | ||||||
|
|
||||||
| ## Cmdlet Design Rules | ||||||
|
|
||||||
|
|
@@ -42,8 +42,8 @@ No rules defined. | |||||
|
|
||||||
| - Support **Force** parameter for interactive sessions. If your cmdlet is used interactively, always | ||||||
| provide a **Force** parameter to override the interactive actions, such as prompts or reading | ||||||
| lines of input. This is important because it allows your cmdlet to be used in non-interactive | ||||||
| scripts and hosts. The following methods can be implemented by an interactive host. | ||||||
| lines of input. The **Force** parameter is important because it allows your cmdlet to be used in | ||||||
| non-interactive scripts and hosts. | ||||||
| - Document output objects | ||||||
| - Module must be loadable | ||||||
| - No syntax errors | ||||||
|
|
@@ -85,7 +85,7 @@ No rules defined. | |||||
| - Avoid using UNC file paths | ||||||
| - Error Handling | ||||||
| - Use `-ErrorAction Stop` when calling cmdlets | ||||||
| - Use `$ErrorActionPreference = 'Stop'/'Continue'` when calling non-cmdlets | ||||||
| - Use `$ErrorActionPreference` set to `Stop` or `Continue` when calling noncmdlets | ||||||
| - Avoid using flags to handle errors | ||||||
| - Avoid using `$?` | ||||||
| - Avoid testing for a null variable as an error condition | ||||||
|
|
@@ -142,7 +142,7 @@ No rules defined. | |||||
|
|
||||||
| ### Severity: TBD | ||||||
|
|
||||||
| - Avoid initializing APIKey and Credentials variables (information disclosure) | ||||||
| - Avoid initializing API key and credential variables (information disclosure) | ||||||
|
|
||||||
| ## DSC Related Rules | ||||||
|
|
||||||
|
|
@@ -168,13 +168,14 @@ No rules defined. | |||||
|
|
||||||
| ### Severity: TBD | ||||||
|
|
||||||
| - For Windows PowerShell v4, resource modules should have a `.psd1` file and `schema.mof` for every | ||||||
| - For Windows PowerShell v4, resource modules should have a `.psd1` and `schema.mof` file for every | ||||||
|
||||||
| - For Windows PowerShell v4, resource modules should have a `.psd1` and `schema.mof` file for every | |
| - For Windows PowerShell v4, resource modules should have a `.psd1` and `schema.mof` file for every |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||||
| --- | ||||||
| description: This article describes various features of PSScriptAnalyzer and how to use them. | ||||||
| ms.date: 04/26/2024 | ||||||
| ms.date: 01/28/2026 | ||||||
| title: Using PSScriptAnalyzer | ||||||
| --- | ||||||
| # Using PSScriptAnalyzer | ||||||
|
|
@@ -104,7 +104,7 @@ function InternalFunction | |||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| You can further restrict suppression based on a function, parameter, class, variable or object's | ||||||
| You can further restrict suppression based on a function, parameter, class, variable, or object's | ||||||
| name by setting the **Target** property of **SuppressMessageAttribute** to a regular expression or | ||||||
| a wildcard pattern. | ||||||
|
|
||||||
|
|
@@ -155,8 +155,8 @@ Param() | |||||
|
|
||||||
| You can create settings that describe the ScriptAnalyzer rules to include or exclude based on | ||||||
| **Severity**. Use the **Settings** parameter of `Invoke-ScriptAnalyzer` to specify configuration. | ||||||
| This enables you to create a custom configuration for a specific environment. We support the | ||||||
| following modes for specifying the settings file: | ||||||
| The **Settings** parameter allows you to create a custom configuration for a specific environment. | ||||||
| ScriptAnalyzer support the following modes for specifying the settings file: | ||||||
|
||||||
| ScriptAnalyzer support the following modes for specifying the settings file: | |
| ScriptAnalyzer supports the following modes for specifying the settings file: |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||||
| --- | ||||||
| description: This article lists the updates to the PSScriptAnalyzer module. | ||||||
| ms.date: 04/29/2025 | ||||||
| ms.date: 01/28/2026 | ||||||
| title: What's new in PSScriptAnalyzer | ||||||
| --- | ||||||
| # What's new in PSScriptAnalyzer | ||||||
|
|
@@ -18,15 +18,15 @@ Breaking changes | |||||
| New features and updates | ||||||
|
|
||||||
| - Add new options (enabled by default) to formatting rule `UseCorrectCasing` to also correct | ||||||
| operators, keywords and commands | ||||||
| operators, keywords, and commands | ||||||
| - `PSAlignAssignmentStatement`: Ignore hashtables with a single key-value pair | ||||||
| - Use `RequiredResource` hashtable to specify PowerShell module versions | ||||||
| - `PSAvoidAssignmentToAutomaticVariable`: Ignore when a Parameter has an Attribute that contains a | ||||||
| Variable expression | ||||||
| - Trim unnecessary trailing spaces from string resources in Strings.resx | ||||||
| - Make Settings type detection more robust | ||||||
| - Add foreach Assignment to `AvoidAssignmentToAutomaticVariable` | ||||||
| - Do not print summary repeatedly for each logger | ||||||
| - Don't print summary repeatedly for each logger | ||||||
| - Set exit code of `Invoke-ScriptAnalyzer -EnableExit` to total number of diagnostics | ||||||
| - `Invoke-ScriptAnalyzer`: Stream diagnostics instead of batching | ||||||
| - `Invoke-ScriptAnalyzer`: Print summary only once per invocation | ||||||
|
|
@@ -52,8 +52,8 @@ when using PowerShell 7 is now `7.2.11`. | |||||
| ### Enhancements | ||||||
|
|
||||||
| - Enable suppression of `PSAvoidAssignmentToAutomaticVariable` for specific variable or parameter | ||||||
| - Upgrade to use .NET 6 since PowerShell 7.0 is now out out of support | ||||||
| - Convert `PSUseSingularNouns` to configurable rule and add `Windows` to allowlist | ||||||
| - Upgrade to use .NET 6 since PowerShell 7.0 is now out of support | ||||||
| - Convert `PSUseSingularNouns` to configurable rule and add `Windows` to the allow list | ||||||
|
||||||
| - Allow suppression of `PSUseSingularNouns` for specific function | ||||||
| - Add `ErrorView` to `SpecialVars.cs` | ||||||
| - Adding `ToString()` methods to `[CorrectionExtent]` and `[DiagnosticRecord]` types | ||||||
|
|
@@ -77,7 +77,7 @@ when using PowerShell 7 is now `7.2.11`. | |||||
| - Make messages of `UseCorrectCasing` more detailed | ||||||
| - Exclude automatic variable `$FormatEnumerationLimit` from analysis by `PSAvoidGlobalVars` and | ||||||
| `PSUseDeclaredVarsMoreThanAssignments` | ||||||
| - `PSAvoidUsingPositionalParameters` - Do not warn on AZ CLI | ||||||
| - `PSAvoidUsingPositionalParameters` - Don't warn on AzCLI | ||||||
|
||||||
| - `PSAvoidUsingPositionalParameters` - Don't warn on AzCLI | |
| - `PSAvoidUsingPositionalParameters` - Don't warn on az CLI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two consecutive spaces between "to" and "
Stop" in the line "Use$ErrorActionPreferenceset toStop". This appears to be a typographical error that should be corrected to use a single space.