-
Notifications
You must be signed in to change notification settings - Fork 463
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
Move forward the version of analyzer packages generated and dogfooded in the repo #3423
Conversation
@@ -178,7 +178,9 @@ private ImmutableHashSet<INamedTypeSymbol> GetUsedNamedTypes(INamedTypeSymbol na | |||
// GetSyntax for VB returns the StatementSyntax instead of BlockSyntax node. | |||
syntax = syntax.FirstAncestorOrSelf<SyntaxNode>(node => IsNamedTypeDeclarationBlock(node), ascendOutOfTrivia: false) ?? syntax; | |||
|
|||
#pragma warning disable RS1030 // Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer |
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 will file an issue to consider rewriting this analyzer to avoid this suppression.
@@ -121,7 +121,7 @@ private static void AnalyzeOperation(OperationAnalysisContext context, Func<Synt | |||
|
|||
private static bool IsCompilerGeneratedParamsArray(IArrayCreationOperation arrayCreationExpression, OperationAnalysisContext context) | |||
{ | |||
var model = context.Compilation.GetSemanticModel(arrayCreationExpression.Syntax.SyntaxTree); | |||
var model = arrayCreationExpression.SemanticModel; |
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.
@Evangelink - thanks for your analyzer!
Codecov Report
@@ Coverage Diff @@
## master #3423 +/- ##
=======================================
Coverage 95.26% 95.26%
=======================================
Files 997 997
Lines 228557 228557
Branches 14684 14686 +2
=======================================
Hits 217724 217724
Misses 9200 9200
Partials 1633 1633 |
@@ -5,7 +5,7 @@ Rule ID | Title | Category | Enabled | Severity | CodeFix | Description | | |||
[CA1001](https://docs.microsoft.com/visualstudio/code-quality/ca1001) | Types that own disposable fields should be disposable | Design | True | Warning | True | A class declares and implements an instance field that is a System.IDisposable type, and the class does not implement IDisposable. A class that declares an IDisposable field indirectly owns an unmanaged resource and should implement the IDisposable interface. | | |||
[CA1003](https://docs.microsoft.com/visualstudio/code-quality/ca1003) | Use generic event handler instances | Design | False | Warning | False | A type contains an event that declares an EventHandler delegate that returns void, whose signature contains two parameters (the first an object and the second a type that is assignable to EventArgs), and the containing assembly targets Microsoft .NET Framework?2.0. | | |||
[CA1008](https://docs.microsoft.com/visualstudio/code-quality/ca1008) | Enums should have zero value | Design | False | Warning | True | The default value of an uninitialized enumeration, just as other value types, is zero. A nonflags-attributed enumeration should define a member by using the value of zero so that the default value is a valid value of the enumeration. If an enumeration that has the FlagsAttribute attribute applied defines a zero-valued member, its name should be ""None"" to indicate that no values have been set in the enumeration. | | |||
[CA1010](https://docs.microsoft.com/visualstudio/code-quality/ca1010) | Collections should implement generic interface | Design | True | Warning | False | To broaden the usability of a collection, implement one of the generic collection interfaces. Then the collection can be used to populate generic collection types. | | |||
[CA1010](https://docs.microsoft.com/visualstudio/code-quality/ca1010) | Generic interface should also be implemented | Design | True | Warning | False | To broaden the usability of a type, implement one of the generic interfaces. This is especially true for collections as they can then be used to populate generic collection types. | |
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 it a manual change? If so it might be nice to have a script at least to check, at best to fail the build.
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.
No, this is through a tool that runs when we build NuGet packages.
@@ -89,7 +89,9 @@ private static void AnalyzeField(SymbolAnalysisContext originalContext, IFieldSy | |||
return; | |||
} | |||
|
|||
#pragma warning disable RS1030 // Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer |
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 it too complex to change now or do you prefer to handle this in a separate PR?
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.
Yeah, this applies to all symbol based analyzers.
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.
🚢
Thank you @dotpaul! |
Recommended to review commit by commit