Repository navigation
Add documentation to all rules supporting a custom suppression target - #2225
Open
Samuel D. Leslie (ralish) wants to merge 1 commit into
Open
Samuel D. Leslie (ralish) wants to merge 1 commit into
Samuel D. Leslie (ralish) wants to merge 1 commit into
Conversation
Samuel D. Leslie (ralish)
requested review from
a team and
Mikey Lombardi (He/Him) (michaeltlombardi)
as code owners
October 11, 2026 03:47
Copilot started reviewing on behalf of
Samuel D. Leslie (ralish)
October 11, 2026 03:47
View session
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The compatible-types guidance omits suppressible static fields and events.
1 open finding
What changed in this PR
Adds rule-specific documentation for custom SuppressMessageAttribute targets.
Changes:
- Documents global and targeted suppression syntax.
- Updates examples and suppression-guide links.
| File | Description |
|---|---|
docs/Rules/UseSingularNouns.md |
Documents function-targeted suppression. |
docs/Rules/UseSingleValueFromPipelineParameter.md |
Documents parameter-set suppression. |
docs/Rules/UseProcessBlockForPipelineCommand.md |
Documents parameter-targeted suppression. |
docs/Rules/UseDeclaredVarsMoreThanAssignments.md |
Documents variable-targeted suppression. |
docs/Rules/UseCorrectCasing.md |
Documents casing-diagnostic targets. |
docs/Rules/UseCompatibleTypes.md |
Documents type-member suppression. |
docs/Rules/ReviewUnusedParameter.md |
Documents parameter-targeted suppression. |
docs/Rules/MissingTryBlock.md |
Documents keyword-targeted suppression. |
docs/Rules/InvalidMultiDotValue.md |
Documents value-targeted suppression. |
docs/Rules/AvoidUsingPositionalParameters.md |
Documents command-targeted suppression. |
docs/Rules/AvoidUsingPlainTextForPassword.md |
Documents parameter-targeted suppression. |
docs/Rules/AvoidUsingConvertToSecureStringWithPlainText.md |
Documents command-targeted suppression. |
docs/Rules/AvoidUsingComputerNameHardcoded.md |
Documents command-targeted suppression. |
docs/Rules/AvoidUsingCmdletAliases.md |
Documents alias-targeted suppression. |
docs/Rules/AvoidUsingBrokenHashAlgorithms.md |
Documents command-targeted suppression. |
docs/Rules/AvoidUsingAllowUnencryptedAuthentication.md |
Documents command-targeted suppression. |
docs/Rules/AvoidNullOrEmptyHelpMessageAttribute.md |
Documents parameter-targeted suppression. |
docs/Rules/AvoidGlobalVars.md |
Documents scoped-variable suppression. |
docs/Rules/AvoidGlobalFunctions.md |
Documents scoped-function suppression. |
docs/Rules/AvoidDynamicallyCreatingVariableNames.md |
Documents dynamic-name suppression. |
docs/Rules/AvoidDefaultValueForMandatoryParameter.md |
Documents parameter-targeted suppression. |
docs/Rules/AvoidAssignmentToAutomaticVariable.md |
Documents variable-targeted suppression. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+193
to
+194
| You can also suppress diagnostics for a specific method or property by passing the full type name | ||
| and the member name, separated by `/`, as the second argument: |
There was a problem hiding this comment.
Fixed in amended commit.
A subset of PSScriptAnalyzer rules support customising a suppression so that it only applies to a specific target. This is performed through the second argument to the `SuppressMessageAttribute` constructor, which is otherwise an empty string to apply the rule globally within its scope. This commit adds documentation to all rules which support customising the target of the suppression, which until now was largely undocumented.
Samuel D. Leslie (ralish)
force-pushed
the
update-rule-doc-suppressions
branch
from
October 11, 2026 03:56
9aefef6 to
649fb23
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

PR Summary
A subset of PSScriptAnalyzer rules support customising a suppression so that it only applies to a specific target. This is performed through the second argument to the
SuppressMessageAttributeconstructor, which is otherwise an empty string to apply the rule globally within its scope.This PR adds documentation to all rules which support customising the target of the suppression, which until now was largely undocumented.
PR Checklist
.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.