Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
mary-georgiou-sonarsource committed May 22, 2024
1 parent a5617ba commit 9423b57
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public sealed class AvoidUnderPosting : SonarDiagnosticAnalyzer

private static void ProcessControllerMethods(SonarSyntaxNodeReportingContext context, ConcurrentDictionary<ITypeSymbol, bool> examinedTypes)
{
if (context.SemanticModel.GetDeclaredSymbol(context.Node) is IMethodSymbol method && method.IsControllerActionMethod())
if (context.SemanticModel.GetDeclaredSymbol(context.Node) is IMethodSymbol method
&& method.IsControllerActionMethod())
{
var modelParameterTypes = method.Parameters
.Where(x => !HasValidateNeverAttribute(x))
Expand Down Expand Up @@ -97,7 +98,8 @@ private static void CheckInvalidProperties(INamedTypeSymbol parameterType, Sonar
&& (type.Constructors.Any(x => x.Parameters.Length == 0) // The type must have a parameterless constructor, unless
|| type.IsValueType // - it's a value type
|| type.IsRecord() // - it's a record type
|| type.IsInterface()); // - it's an interface (although the type that implements will be actually used)
|| type.IsInterface() // - it's an interface (although the type that implements will be actually used)
|| type.Is(KnownType.System_String)); // - it has a custom Model Binder (e.g. System.String has one)

private static bool CanBeNull(ITypeSymbol type) =>
type is ITypeParameterSymbol { HasValueTypeConstraint: false }
Expand Down

0 comments on commit 9423b57

Please sign in to comment.