Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ csharp_style_var_elsewhere = true
dotnet_diagnostic.RCS1264.severity = none
# Add braces.
dotnet_diagnostic.IDE0011.severity = warning
# Use pattern matching to avoid `as` followed by a `null` check.
dotnet_diagnostic.IDE0019.severity = warning
Comment thread
glen-84 marked this conversation as resolved.
dotnet_diagnostic.RCS1221.severity = none
# Use collection initializers or expressions.
dotnet_diagnostic.IDE0028.severity = warning
# Use null propagation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
var attribute = node.AncestorsAndSelf().OfType<AttributeSyntax>().FirstOrDefault();

// Find the attribute list
var attributeList = attribute?.Parent as AttributeListSyntax;
if (attributeList is null)
if (attribute?.Parent is not AttributeListSyntax attributeList)
{
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ private static async Task<Document> RemoveAttributeAsync(
}

// Get the attribute list that contains this attribute
var attributeList = attribute.Parent as AttributeListSyntax;
if (attributeList is null)
if (attribute.Parent is not AttributeListSyntax attributeList)
{
return document;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ private static async Task<Document> RemoveShareableAttributeAsync(
}

// Find the attribute list that contains this attribute
var attributeList = attribute.Parent as AttributeListSyntax;
if (attributeList is null)
if (attribute.Parent is not AttributeListSyntax attributeList)
{
return document;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ private static void AnalyzeMethodDeclaration(SyntaxNodeAnalysisContext context)
var methodDeclaration = (MethodDeclarationSyntax)context.Node;

// Get the containing type (class or record)
var containingType = methodDeclaration.Parent as TypeDeclarationSyntax;
if (containingType is null)
if (methodDeclaration.Parent is not TypeDeclarationSyntax containingType)
{
return;
}
Expand All @@ -48,8 +47,7 @@ private static void AnalyzePropertyDeclaration(SyntaxNodeAnalysisContext context
var propertyDeclaration = (PropertyDeclarationSyntax)context.Node;

// Get the containing type (class or record)
var containingType = propertyDeclaration.Parent as TypeDeclarationSyntax;
if (containingType is null)
if (propertyDeclaration.Parent is not TypeDeclarationSyntax containingType)
{
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,7 @@ static void BuildArgumentLookup(
ObjectFieldConfiguration definition,
IResolverCompiler resolverCompiler)
{
var method = (definition.ResolverMember ?? definition.Member) as MethodInfo;

if (method is null)
if ((definition.ResolverMember ?? definition.Member) is not MethodInfo method)
{
return null;
}
Expand Down Expand Up @@ -560,9 +558,7 @@ static void BuildArgumentLookup(
InterfaceFieldConfiguration definition,
IResolverCompiler resolverCompiler)
{
var method = (definition.ResolverMember ?? definition.Member) as MethodInfo;

if (method is null)
if ((definition.ResolverMember ?? definition.Member) is not MethodInfo method)
{
return null;
}
Expand Down
Loading