Azure / Azure/azure-sdk-tools

[Dotnet Analyzer] Add a new rule to validate the async methods always ends with `Async` in their names

Open
#6,770 0 comments 0 reactions 0 assignees View on GitHub
.NET .NETClientSDKAnalyzers
Dominant language
C#
Stars
135
Forks
260
Avg merge
3d 1h
Merged PRs (30d)
143

Description

Currently we do not have a rule for this purpose.
We should have a rule the enforce the async methods to ends with `Async` in their names in case sometimes we misspell.
The definition of "async method" should be:
1. the methods that has `async` keyword (the most common case)
2. the methods return Task or Task (this could happen if in the implementation there is no `await` keyword used)
3. the methods return AsyncPageable because we do not need `await` keyword when we implement the pageable methods.

Contributor guide

Open the contributing guide

Research direction

No file or test is named. Start by locating the existing .NET analyzer rules and their tests, then verify how async methods are identified for the three cases in the issue. Done means methods matching those definitions are diagnosed unless their names end with `Async`, with tests covering each case.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.