-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Ban DiagnosticDescriptor ctor in CodeStyle layer #50031
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
Conversation
|
@mavasani I can't figure out why the build is passing here. Can you assist please? |
|
Sure, let me investigate. |
|
Hopefully, you should see build failure with RS0030 diagnostics now. |
|
@Youssef1313 I wouldn't worry about violation in I think we do want to run |
| T:Microsoft.CodeAnalysis.CodeStyle.NotificationOption; Use 'Microsoft.CodeAnalysis.CodeStyle.NotificationOption2' instead | ||
| T:Microsoft.CodeAnalysis.CodeStyle.NotificationOption; Use 'Microsoft.CodeAnalysis.CodeStyle.NotificationOption2' instead | ||
| M:Microsoft.CodeAnalysis.DiagnosticDescriptor.#ctor(System.String,System.String,System.String,System.String,Microsoft.CodeAnalysis.DiagnosticSeverity,System.Boolean,System.String,System.String,System.String[]); Analyzers should extend 'AbstractBuiltInCodeStyleDiagnosticAnalyzer' or 'AbstractCodeQualityDiagnosticAnalyzer' instead | ||
| M:Microsoft.CodeAnalysis.DiagnosticDescriptor.#ctor(System.String,Microsoft.CodeAnalysis.LocalizableString,Microsoft.CodeAnalysis.LocalizableString,System.String,Microsoft.CodeAnalysis.DiagnosticSeverity,System.Boolean,Microsoft.CodeAnalysis.LocalizableString,System.String,System.String[]); Analyzers should extend 'AbstractBuiltInCodeStyleDiagnosticAnalyzer' or 'AbstractCodeQualityDiagnosticAnalyzer' instead |
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.
Is there a way to ban all overloads of the constructor?
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 don't believe so.
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.
@Youssef1313 That would be a feature request for the Banned API analyzer. Feel free to file one on the roslyn-analyzers repo.
mavasani
left a comment
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.
LGTM
If you can also update the help links for IDE0005 descriptors, that will be nice. Thanks!
|
@Youssef1313 You also have some merge conflicts. |
The above method is used by IDE0053 We should check whether it currently has the correct link. If it doesn't and the current build didn't fail, we need think of an alternative/enhancement. Probably add a new test to [IDEDiagnosticIDConfigurationTests] (https://github.com/dotnet/roslyn/blob/5eae4001901cb03a71c668f2aaa42783ea50570b/src/EditorFeatures/Test/Diagnostics/IDEDiagnosticIDConfigurationTests.cs) for validating the help links. |
@Youssef1313 I think we are fine here - we don't expect many analyzers to be IDE-only analyzers (not present in CodeStyle layer). The guidance for future is absolutely to add analyzers to the shared layer, which implicitly adds them to CodeStyle layer. If absolutely required, we can also add the banned symbols added in this PR to https://github.com/dotnet/roslyn/blob/master/src/Features/BannedSymbols.txt |
|
@Youssef1313 Tests are still failing. |
ghost
left a comment
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.
Auto-approval
Fixes #50011