From 01206efdb64c491f929ca77cbc4b0b739f8c075e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rald=20Barr=C3=A9?= Date: Sat, 27 Apr 2024 20:12:16 -0400 Subject: [PATCH] Add documentation for MA0156 and MA0157 --- README.md | 2 ++ docs/README.md | 14 ++++++++++++++ docs/Rules/MA0156.md | 11 +++++++++++ docs/Rules/MA0157.md | 11 +++++++++++ 4 files changed, 38 insertions(+) create mode 100644 docs/Rules/MA0156.md create mode 100644 docs/Rules/MA0157.md diff --git a/README.md b/README.md index 7ee8f77e8..87bb25585 100755 --- a/README.md +++ b/README.md @@ -171,6 +171,8 @@ If you are already using other analyzers, you can check [which rules are duplica |[MA0153](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0153.md)|Design|Do not log symbols decorated with DataClassificationAttribute directly|⚠️|✔️|❌| |[MA0154](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0154.md)|Design|Use langword in XML comment|ℹ️|✔️|✔️| |[MA0155](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0155.md)|Design|Do not use async void methods|⚠️|❌|❌| +|[MA0156](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0156.md)|Design|Use 'Async' suffix when a method returns IAsyncEnumerable\|⚠️|❌|❌| +|[MA0157](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0157.md)|Design|Do not use 'Async' suffix when a method does not return IAsyncEnumerable\|⚠️|❌|❌| diff --git a/docs/README.md b/docs/README.md index fd8e07f31..2a7005ae7 100755 --- a/docs/README.md +++ b/docs/README.md @@ -155,6 +155,8 @@ |[MA0153](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0153.md)|Design|Do not log symbols decorated with DataClassificationAttribute directly|⚠️|✔️|❌| |[MA0154](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0154.md)|Design|Use langword in XML comment|ℹ️|✔️|✔️| |[MA0155](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0155.md)|Design|Do not use async void methods|⚠️|❌|❌| +|[MA0156](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0156.md)|Design|Use 'Async' suffix when a method returns IAsyncEnumerable\|⚠️|❌|❌| +|[MA0157](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0157.md)|Design|Do not use 'Async' suffix when a method does not return IAsyncEnumerable\|⚠️|❌|❌| |Id|Suppressed rule|Justification| |--|---------------|-------------| @@ -626,6 +628,12 @@ dotnet_diagnostic.MA0154.severity = suggestion # MA0155: Do not use async void methods dotnet_diagnostic.MA0155.severity = none + +# MA0156: Use 'Async' suffix when a method returns IAsyncEnumerable +dotnet_diagnostic.MA0156.severity = none + +# MA0157: Do not use 'Async' suffix when a method does not return IAsyncEnumerable +dotnet_diagnostic.MA0157.severity = none ``` # .editorconfig - all rules disabled @@ -1092,4 +1100,10 @@ dotnet_diagnostic.MA0154.severity = none # MA0155: Do not use async void methods dotnet_diagnostic.MA0155.severity = none + +# MA0156: Use 'Async' suffix when a method returns IAsyncEnumerable +dotnet_diagnostic.MA0156.severity = none + +# MA0157: Do not use 'Async' suffix when a method does not return IAsyncEnumerable +dotnet_diagnostic.MA0157.severity = none ``` diff --git a/docs/Rules/MA0156.md b/docs/Rules/MA0156.md new file mode 100644 index 000000000..4e214cdf3 --- /dev/null +++ b/docs/Rules/MA0156.md @@ -0,0 +1,11 @@ +# MA0156 - Use 'Async' suffix when a method returns IAsyncEnumerable\ + +Methods that return `IAsyncEnumerable` should have the Async suffix. + +````c# +// compliant +IAsyncEnumerable FooAsync() => throw null; + +// non-compliant +IAsyncEnumerable Foo() => throw null; +```` diff --git a/docs/Rules/MA0157.md b/docs/Rules/MA0157.md new file mode 100644 index 000000000..eab1b3f06 --- /dev/null +++ b/docs/Rules/MA0157.md @@ -0,0 +1,11 @@ +# MA0157 - Do not use 'Async' suffix when a method does not return IAsyncEnumerable\ + +Methods that do not return `IAsyncEnumerable` should not have the Async suffix. + +````c# +// compliant +IAsyncEnumerable Foo() => throw null; + +// non-compliant +IAsyncEnumerable FooAsync() => throw null; +````