-
Notifications
You must be signed in to change notification settings - Fork 468
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 RSxxxx diagnostic for compilation end diagnostic descriptors without CompilationEnd custom tag #6397
Conversation
…out CompilationEnd custom tag Closes dotnet#6282
@Youssef1313 @Evangelink for review. Thanks! |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #6397 +/- ##
========================================
Coverage 96.11% 96.11%
========================================
Files 1361 1361
Lines 316031 316545 +514
Branches 10195 10214 +19
========================================
+ Hits 303738 304244 +506
- Misses 9861 9863 +2
- Partials 2432 2438 +6 |
src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/DiagnosticDescriptorCreationAnalyzer.cs
Show resolved
Hide resolved
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.
Does this work for DiagnosticDescriptorHelper.Create
we have in this repo?
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 (given a quick look)
I think it should. Analyzing CustomTags argument is done by existing code in the analyzer. Even otherwise, I think we primarily care about analyzers outside this repo to benefit from this new warning. |
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.
It looks like there is a violation in this repo?
Lines 90 to 91 in e378446
context.RegisterCompilationEndAction(context => AnalyzeSymbol(context.ReportDiagnostic, context.Compilation.Assembly, | |
supportedAttriubte, unsupportedAttribute, knownPlatforms, context.CancellationToken)); |
Lines 34 to 59 in e378446
internal static readonly DiagnosticDescriptor UnknownPlatform = DiagnosticDescriptorHelper.Create(RuleId, | |
s_localizableTitle, | |
CreateLocalizableResourceString(nameof(UseValidPlatformStringUnknownPlatform)), | |
DiagnosticCategory.Interoperability, | |
RuleLevel.BuildWarning, | |
description: s_localizableDescription, | |
isPortedFxCopRule: false, | |
isDataflowRule: false); | |
internal static readonly DiagnosticDescriptor InvalidVersion = DiagnosticDescriptorHelper.Create(RuleId, | |
s_localizableTitle, | |
CreateLocalizableResourceString(nameof(UseValidPlatformStringInvalidVersion)), | |
DiagnosticCategory.Interoperability, | |
RuleLevel.BuildWarning, | |
description: s_localizableDescription, | |
isPortedFxCopRule: false, | |
isDataflowRule: false); | |
internal static readonly DiagnosticDescriptor NoVersion = DiagnosticDescriptorHelper.Create(RuleId, | |
s_localizableTitle, | |
CreateLocalizableResourceString(nameof(UseValidPlatformStringNoVersion)), | |
DiagnosticCategory.Interoperability, | |
RuleLevel.BuildWarning, | |
description: s_localizableDescription, | |
isPortedFxCopRule: false, | |
isDataflowRule: false); |
Though this one can't easily be caught as context.ReportDiagnostic
isn't invoked, but rather captured as a method group and passed down few calls to report a diagnostic.
Thanks, I'll create a separate PR to fix this issue. |
Closes #6282