Skip to content

Commit

Permalink
Update to 1.3.0-beta3 (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
Djoums authored Jun 8, 2024
1 parent 1c3f121 commit 19a0100
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ecoCode-csharp-test-project.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="EcoCode" Version="1.3.0-beta1" PrivateAssets="all">
<PackageReference Include="EcoCode" Version="1.3.0-beta3" PrivateAssets="all">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
Expand Down
52 changes: 52 additions & 0 deletions src/EC93.ReturnTaskDirectly.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
namespace EcoCode.LiveWarnings;

internal static class ReturnTaskDirectly
{
public static Task DontWarnWhenReturningTask1() => Task.Delay(0);
public static Task DontWarnWhenReturningTask2()
{
return Task.Delay(0);
}
public static Task DontWarnWhenReturningTask3()
{
Console.WriteLine();
return Task.Delay(0);
}

public static async Task DontWarnWithMultipleStatements1Async()
{
Console.WriteLine();
await Task.Delay(0).ConfigureAwait(false);
}
public static async Task DontWarnWithMultipleStatements2Async()
{
await Task.Delay(0).ConfigureAwait(false);
await Task.Delay(0).ConfigureAwait(false);
}

public static async Task WarnOnSingleAwaitExpressionAsync() => // EC93
// Comment
await Task.Delay(0).ConfigureAwait(false);

public static async Task WarnOnSingleAwaitBody1Async() // EC93
{
// Comment 0
await Task.Delay(0).ConfigureAwait(false); // Comment 1
// Comment 2
}

public static async Task<int> WarnOnSingleAwaitBody2Async() // EC93
{
// Comment 0
return await Task.FromResult(0).ConfigureAwait(false); // Comment 1
// Comment 2
}

public static async Task DontWarnOnNestedAwaitExpressionAsync() =>
await Task.Delay(await Task.FromResult(0).ConfigureAwait(false)).ConfigureAwait(false);

public static async Task DontWarnOnNestedAwaitBodyAsync()
{
await Task.Delay(await Task.FromResult(0).ConfigureAwait(false)).ConfigureAwait(false);
}
}

0 comments on commit 19a0100

Please sign in to comment.