IntelliTect / IntelliTect/CodingGuidelines

Create code fix to convert non-nullable reference type auto property to null safe version

オープン
#111 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
analyzer enhancement Hacktoberfest
主要言語
C#
スター
12
フォーク
16
平均マージ
2分
マージ済み PR(30日)
7

説明

We would like to create a code fix to convert auto properties to null safe equivalent following the pattern in #88.

This code fix should not be shown for:
- Read only properties
- Nullable reference types
- When nullable is not enabled

Expected:
This
```
public string FirstName { get; set; }
```
Becomes:
```
//TODO: Initialize FirstName during initialization
private string? _FirstName;
public string FirstName
{
get => _FirstName!;
set => _FirstName = value ?? throw new ArgumentNullException(nameof(value));
}
```

This:
```
public string FirstName { get; private set; }
```
Becomes:
```
//TODO: Initialize FirstName during initialization
private string? _FirstName;
public string FirstName
{
get => _FirstName!;
private set => _FirstName = value ?? throw new ArgumentNullException(nameof(value));
}
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。