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
Add SuppressMessageAttribute type accelerator for System.Diagnostics.CodeAnalysis.SuppressMessageAttribute #16131
base: master
Are you sure you want to change the base?
Conversation
…CodeAnalysis.SuppressMessageAttribute
| { typeof(SupportsWildcardsAttribute), new[] { "SupportsWildcards" } }, | ||
| { typeof(SuppressMessageAttribute), new[] { "SuppressMessageAttribute" } }, |
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.
Given other attribute accelerators seem to deliberately drop the attribute suffix in the name, I'd suggest we should do the same here.
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.
Didn't think of that, good point. Happy to make that change if other's agree as well. At this moment, the alias name wasn't even agreed in the issue, therefore this name is just the first proposal so I'm aware I could be asked to change it to anything. People actually suggested SuppressAnalyzer in the issue. Let's use this PR to decide on the name.
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.
I'd definitely think it best to keep the same name as the actual type unless we wanted to go even shorter, with something like [suppress].
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.
l like being a bit more specific e.g. "suppress what" oh, [SuppressMessage]. And I like it that I can mentally add Attribute to get the corresponding .NET type.
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
|
@Jaykul had a good alternative option of including this in PSSA instead, what do people think is better #14784 (comment) |
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
I think we could have both option. If PSSA is not loaded PSRL would warn on the name, doesn't it? Also completion will do not work... |
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
|
This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 15 days. It will be closed if no further activity occurs within 10 days of this comment. |
PR Summary
Implements #14784
I observed though that when using this type accelerator for PowerShell versions without this type accelerator,
PSScriptAnalyzer(PSSA) does not throw but just ignored the attribute, I initially expected it to throw an error, not sure it this is what the behavior of PSSA should be and if this should be improved. I'd suggest to let PSSA emit a warning if it encounters that in an old PS version and in order to get it highlighted in the editor, PSSA should probably emit a diagnosticrecord as well on those versions similar to how it does for parsererrorsPR Context
See linked issue. Because this type is long and uses for PSSA suppressions.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).