Skip to content
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

Fix S4529: Should not highlight constructors, properties and methods with NonActionAttribute #2109

Merged
merged 2 commits into from
Nov 19, 2018

Conversation

valhristov
Copy link
Contributor

Fix #1991

@ghost ghost assigned valhristov Nov 16, 2018
@ghost ghost added the Status: Needs Review label Nov 16, 2018
@valhristov valhristov changed the title Fix S4529: Should not highlight constructors [DO NOT MERGE] Fix S4529: Should not highlight constructors Nov 16, 2018
@valhristov valhristov changed the title [DO NOT MERGE] Fix S4529: Should not highlight constructors Fix S4529: Should not highlight constructors Nov 16, 2018
@valhristov valhristov changed the title Fix S4529: Should not highlight constructors Fix S4529: Should not highlight constructors, properties and methods with NonActionAttribute Nov 16, 2018
);
KnownType.System_Web_Mvc_Controller);

private static readonly ImmutableArray<KnownType> nonactionTypes =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[minor] The a should be uppercase (i.e. nonActionTypes)

@@ -44,6 +49,8 @@ public static class AspNetMvcHelper
/// </summary>
public static bool IsControllerMethod(this IMethodSymbol methodSymbol) =>
methodSymbol.GetEffectiveAccessibility() == Accessibility.Public &&
methodSymbol.MethodKind == MethodKind.Ordinary &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put this line before the effective accessibility check as it is simpler (faster).

}

[DataTestMethod]
[DataRow("3.0.20105.1")]
[DataRow("2.1.3")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain why you did this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is for ASP.NET MVC Core (the attributes are not present in the desktop version of ASP.NET MVC)

get { return 0; }
set { }
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test with an event, an operator and a destructor.

Set(ByVal value As Integer)
End Set
End Property

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as for C#.

@Evangelink Evangelink merged commit 480f5f6 into feature/hotspots Nov 19, 2018
@Evangelink Evangelink deleted the val/fix-endpoints branch November 19, 2018 13:24
@ghost ghost removed the Status: Needs Review label Nov 19, 2018
Evangelink pushed a commit that referenced this pull request Nov 19, 2018
Evangelink pushed a commit that referenced this pull request Nov 19, 2018
Evangelink pushed a commit that referenced this pull request Nov 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants