-
Notifications
You must be signed in to change notification settings - Fork 499
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
Snippet Issues: Suppress PSScriptAnalyzer Rules malformed (scope, function, param) #5108
Comments
@TMA-2 thanks for your submissions! The snippets are just JSON files with a particular syntax, so these are very easy to submit fixes as a pull request, and we'll happily shepherd any pull requests you have for these fixes. Marking this as "up for grabs" |
Thanks very much! I'm familiar enough with snippets (unlike JS or TS) that I just might give that a shot. |
Fix for issue PowerShell#5108 - Corrects a missing close comment in the Function rule snippet - Corrects the tab stop numbering in the Parameter rule snippet as well as duplicate use of `$TM_SELECTED_TEXT` - Adds a missing comma in The Scope rule snippet - Minor formatting
Well, I've created the PR, hopefully correctly! |
Thanks so much @TMA-2! Changes to the snippets are fairly low risk. I looked over your PR and think it's good, about to get it merged and into the pre-release. We really appreciate it. |
Fix for issue #5108 - Corrects a missing close comment in the Function rule snippet - Corrects the tab stop numbering in the Parameter rule snippet as well as duplicate use of `$TM_SELECTED_TEXT` - Adds a missing comma in The Scope rule snippet - Minor formatting
Prerequisites
Summary
The snippets for Function: Suppress PSScriptAnalyzer Rule, Scope, and Parameter are all malformed in various ways, from breaking issues to style suggestions. After noticing more than four, I've decided to just put them in a list with screenshots in the appropriate section. Apologies for the verbosity. Fixed proposals are in Steps to Reproduce.
Scope: Suppress PSScriptAnalyzer Rule
Target=
line.<#Category#>
andTarget
tab stops are using 1, clobbering each other's values. Propose separating by changing one of them to 2.<#Category#>'${1:PSUseDeclaredVarsMoreThanAssignments}'
andTarget='${1:${TM_SELECTED_TEXT:RegexOrGlobPatternToMatchName}}'
Justification
parameter tab stop.'${0:Reason for suppressing}}'
[SuppressMessageAttribute]
is missing from the snippet's prefixes.Parameter: Suppress PSScriptAnalyzer Rule
<#Category#>
is on the same line as the type declaration, different to the other three snippets. I'd propose moving it to a new line to match.[Diagnostics.CodeAnalysis.SuppressMessageAttribute(<#Category#>
(...)ParameterName
andJustification
, and both are using$TM_SELECTED_TEXT
, so they clobber each other. Propose changingParameterName
to 1 and removing$TM_SELECTED_TEXT
from the same line to match the others.<#ParameterName#>'${0:${TM_SELECTED_TEXT:ParamName}}'
andJustification = '${0:${TM_SELECTED_TEXT:Reason for suppressing}}'
Function: Suppress PSScriptAnalyzer Rule
CheckId
is missing, breaking the snippet.<#CheckId>
General Proposals
Justification
) since it looks like most other snippets leave them out, especially the other PSScriptAnalyzer rule snippets.${2|Function,Parameter,<...>|}
.PowerShell Version
Visual Studio Code Version
Extension Version
Steps to Reproduce
Ctrl+Alt+J
or selectSnippets: Insert Snippet
to bring up snippetssuppress-message-rule-scope
,suppress-message-rule-function
, andsuppress-message-rule-parameter
in turn.Proposed Fixes
Scope: Suppress PSScriptAnalyzer Rule
Parameter: Suppress PSScriptAnalyzer Rule
Function: Suppress PSScriptAnalyzer Rule
Visuals
Examples
Logs
N/A. This is solely limited to snippets included with the extension as opposed to anything that would be found in a log,
The text was updated successfully, but these errors were encountered: