Skip to content

Commit

Permalink
feat: Add dx to catch ConfigureAwait(false) (#152)
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Evenson <2031163+benjiro@users.noreply.github.com>
  • Loading branch information
benjiro authored Sep 22, 2023
1 parent dd92cbf commit 9c42d4a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ dotnet_diagnostic.IDE0005.severity = none
# RS0041: Public members should not use oblivious types
dotnet_diagnostic.RS0041.severity = suggestion

# CA2007: Do not directly await a Task
dotnet_diagnostic.CA2007.severity = error

[obj/**.cs]
generated_code = true

Expand Down
1 change: 1 addition & 0 deletions build/Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<LangVersion>7.3</LangVersion>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
Expand Down
2 changes: 2 additions & 0 deletions test/OpenFeature.Benchmarks/OpenFeatureClientBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using AutoFixture;
using BenchmarkDotNet.Attributes;
Expand All @@ -12,6 +13,7 @@ namespace OpenFeature.Benchmark
[SimpleJob(RuntimeMoniker.Net60, baseline: true)]
[JsonExporterAttribute.Full]
[JsonExporterAttribute.FullCompressed]
[SuppressMessage("Reliability", "CA2007:Consider calling ConfigureAwait on the awaited task")]
public class OpenFeatureClientBenchmarks
{
private readonly string _clientName;
Expand Down
2 changes: 2 additions & 0 deletions test/OpenFeature.Tests/FeatureProviderTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using AutoFixture;
using FluentAssertions;
Expand All @@ -9,6 +10,7 @@

namespace OpenFeature.Tests
{
[SuppressMessage("Reliability", "CA2007:Consider calling ConfigureAwait on the awaited task")]
public class FeatureProviderTests : ClearOpenFeatureInstanceFixture
{
[Fact]
Expand Down
2 changes: 2 additions & 0 deletions test/OpenFeature.Tests/OpenFeatureClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading.Tasks;
using AutoFixture;
Expand All @@ -16,6 +17,7 @@

namespace OpenFeature.Tests
{
[SuppressMessage("Reliability", "CA2007:Consider calling ConfigureAwait on the awaited task")]
public class OpenFeatureClientTests : ClearOpenFeatureInstanceFixture
{
[Fact]
Expand Down
2 changes: 2 additions & 0 deletions test/OpenFeature.Tests/OpenFeatureHookTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading.Tasks;
using AutoFixture;
Expand All @@ -14,6 +15,7 @@

namespace OpenFeature.Tests
{
[SuppressMessage("Reliability", "CA2007:Consider calling ConfigureAwait on the awaited task")]
public class OpenFeatureHookTests : ClearOpenFeatureInstanceFixture
{
[Fact]
Expand Down

0 comments on commit 9c42d4a

Please sign in to comment.