Skip to content
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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bergmeister
Copy link
Contributor

@bergmeister bergmeister commented Sep 22, 2021

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 parsererrors

PR Context

See linked issue. Because this type is long and uses for PSSA suppressions.

PR Checklist

@bergmeister bergmeister marked this pull request as ready for review Sep 22, 2021
@bergmeister bergmeister requested a review from daxian-dbw as a code owner Sep 22, 2021
@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Sep 22, 2021
{ typeof(SupportsWildcardsAttribute), new[] { "SupportsWildcards" } },
{ typeof(SuppressMessageAttribute), new[] { "SuppressMessageAttribute" } },
Copy link
Collaborator

@vexx32 vexx32 Sep 22, 2021

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.

Copy link
Contributor Author

@bergmeister bergmeister Sep 22, 2021

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.

Copy link
Collaborator

@vexx32 vexx32 Sep 23, 2021

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

Copy link
Collaborator

@rkeithhill rkeithhill Sep 23, 2021

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.

@msftbot msftbot bot added the Review - Needed The PR is being reviewed label Oct 1, 2021
@msftbot
Copy link

msftbot bot commented Oct 1, 2021

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

rjmholt
rjmholt approved these changes Oct 5, 2021
@bergmeister
Copy link
Contributor Author

bergmeister commented Oct 5, 2021

@Jaykul had a good alternative option of including this in PSSA instead, what do people think is better #14784 (comment)
The reason why doing it in PSSA is better is due to use cases of e.g. another contributor opening a repo with new aliases suppression in vs code and not using the latest version of PowerShell or Windows PowerShell for the PowerShell extension. As the extension ships with PSSA, this would result in a more consistent change for users and also more users would benefit. Thoughts?
I haven't tested what the behaviour would be if it was defined in both PowerShell and PSSA is that something we should consider as well?

@msftbot msftbot bot removed the Review - Needed The PR is being reviewed label Nov 3, 2021
@msftbot msftbot bot added the Review - Needed The PR is being reviewed label Nov 10, 2021
@msftbot
Copy link

msftbot bot commented Nov 10, 2021

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@iSazonov
Copy link
Collaborator

iSazonov commented Nov 10, 2021

I haven't tested what the behaviour would be if it was defined in both PowerShell and PSSA is that something we should consider as well?

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

@msftbot msftbot bot removed the Review - Needed The PR is being reviewed label Nov 10, 2021
@msftbot msftbot bot added the Review - Needed The PR is being reviewed label Nov 19, 2021
@msftbot
Copy link

msftbot bot commented Nov 19, 2021

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@bergmeister bergmeister marked this pull request as draft Sep 14, 2022
@msftbot msftbot bot added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Sep 17, 2022
@msftbot msftbot bot added the Stale label Oct 2, 2022
@msftbot
Copy link

msftbot bot commented Oct 2, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log Review - Needed The PR is being reviewed Stale Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants