Add analyzer to check Guard clauses used for non-arguments
まだ誰も着手していません。
評価
調査の方向性
ファイル、テスト、エントリーポイントは指定されていません。まずツールキットにある既存の Guard clauses と analyzer projects を特定し、次に analyzer がメソッド引数を他の式とどのように区別するかを定義します。完了の条件は、提供された C# の例が警告を生成し、有効な引数チェックには警告が付かないことです。
索引モデルが issue の本文から書いたものです。
説明
Overview
I've found guard clauses being abused and used to validate non-arguments. It would be great to have an analyzer that checks for incorrect usage where one of the Guard clauses is used for something that is not an argument to a method, property, etc.
Here is an example of something that I would like the analyzer to catch:
class C
{
string P { get; }
void M(string s)
{
Guard.IsNotNull(P); // <-- P is not an argument!
}
}
API breakdown
N/A for an analyzer.
Usage example
class C
{
string P { get; }
void M(string s)
{
Guard.IsNotNull(P); // <-- The analyzer should report a warning, squiggle, etc.
}
}
Breaking change?
No
Alternatives
Anyone could write an analyzer to do this outside of the toolkit, but it would obviously be best and most natural to have it included as part of the toolkit itself.
Additional context
This is predicated on my understanding that the Guard clauses provided by the toolkit are specifically intended for arguments.
Help us help you
No, just wanted to propose this
- 主要言語
- C#
- スター
- 3.8k
- フォーク
- 402
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
CommunityToolkit/dotnet のほかの issue
-
RelayCommand<T>.CanExecute(null) returns false for value types without a predicate対応中かも @apachezy が 121 日前に担当しました。 オープンbug :bug:
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
CommunityToolkit/dotnet#1206 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
CommunityToolkit/dotnet#1186 ·
-
bug :bug:
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
CommunityToolkit/dotnet#648 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
CommunityToolkit/dotnet#1218 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
CommunityToolkit/dotnet#1217 ·
CommunityToolkit/dotnet の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 2 日以内に返信
-
area: core bug help wanted ready
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
ZaidX88/sluice#265 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
area: remote bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
📅 Sprint 4 Module-Tools Setup Submit:None 🦔 Size Tiny
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
CodeYourFuture/Module-Tools#712 ·