Skip to content

Ignore static Main methods in NamingStyle analyzer#51831

Merged
jmarolf merged 4 commits intodotnet:mainfrom
Youssef1313:patch-41
Apr 15, 2021
Merged

Ignore static Main methods in NamingStyle analyzer#51831
jmarolf merged 4 commits intodotnet:mainfrom
Youssef1313:patch-41

Conversation

@Youssef1313
Copy link
Member

@Youssef1313 Youssef1313 commented Mar 12, 2021

Closes #49648
Fixes #50734

@ghost ghost added the Area-IDE label Mar 12, 2021
@Youssef1313 Youssef1313 changed the title Add tests for #49648 Ignore static Main methods in NamingStyle analyzer Mar 17, 2021
@Youssef1313 Youssef1313 marked this pull request as ready for review March 17, 2021 10:42
@Youssef1313
Copy link
Member Author

@CyrusNajmabadi Can you review please? Thanks.

if (string.IsNullOrEmpty(symbol.Name))
if (string.IsNullOrEmpty(symbol.Name) ||
// Heuristic for recognizing entry points.
symbol.IsStatic && symbol.Name == WellKnownMemberNames.EntryPointMethodName)
Copy link
Contributor

Choose a reason for hiding this comment

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

we have an existing helper for this: IsEntryPoint

can you extrac tthis out (an extension on IMethodSymbol would be fine) and use the same for both?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, this method should be extracted out to a general helper and used here.

@Youssef1313 Youssef1313 requested a review from a team as a code owner April 15, 2021 06:46
Copy link
Contributor

@jmarolf jmarolf left a comment

Choose a reason for hiding this comment

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

:shipit:

@jmarolf jmarolf merged commit 639c8f7 into dotnet:main Apr 15, 2021
@ghost ghost added this to the Next milestone Apr 15, 2021
@jmarolf
Copy link
Contributor

jmarolf commented Apr 15, 2021

thanks @Youssef1313 !

@Youssef1313 Youssef1313 deleted the patch-41 branch April 16, 2021 06:47
@jinujoseph jinujoseph added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Apr 19, 2021
@dibarbet dibarbet modified the milestones: Next, 16.10.P3 Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Naming rule analyzer should not suggest MainAsync IDE1006 shouldn't report on top-level Main method with await operators

5 participants